fix case when errors are not cached,
and a file was not used often enough to keep open
and it has been removed before it was kept open
diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c
index abd0e2a..6bb6fd2 100644
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -411,9 +411,11 @@
 
         cache->current--;
 
-        if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
-            ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
-                          ngx_close_file_n " \"%s\" failed", file->name);
+        if (of->fd != NGX_INVALID_FILE) {
+            if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
+                ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
+                              ngx_close_file_n " \"%s\" failed", file->name);
+            }
         }
 
         ngx_free(file->name);