diff --git a/server/confpars.c b/server/confpars.c
index a9b4b57..761b102 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -168,7 +168,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
if (result != ulen)
log_fatal ("%s: short read of %d bytes instead of %d.",
filename, ulen, result);
- close (file);
memfile:
/* If we're recording, write out the filename and file contents. */
if (trace_record ())
@@ -179,6 +178,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
status = new_parse(&cfile, file, NULL, 0, filename, 0);
#endif
noreplay:
+ close (file);
if (status != ISC_R_SUCCESS || cfile == NULL)
return status;