diff --git a/magick/cache.c b/magick/cache.c
index 4202322..98a2cf5 100644
--- a/magick/cache.c
+++ b/magick/cache.c
@@ -694,7 +694,13 @@
     p=(CacheInfo *) GetNextKeyInSplayTree(cache_resources);
   }
   if (q != (CacheInfo *) NULL)
-    (void) close(q->file); /* relinquish least recently used cache */
+    {
+      /*
+        Close least recently used cache.
+      */
+      (void) close(q->file);
+      q->file=(-1);
+    }
   UnlockSemaphoreInfo(cache_semaphore);
 }