Index: trunk/ippToPsps/src/Fits.c
===================================================================
--- trunk/ippToPsps/src/Fits.c	(revision 31929)
+++ trunk/ippToPsps/src/Fits.c	(revision 31930)
@@ -38,12 +38,17 @@
     this->logger->print(this->logger, MSG_DEBUG, "Fits", "Destructor\n");
 
-    int status = 0;
-    if (fits_close_file(this->file, &status)) {
-
-        this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to close FITS file '%s'\n", this->path);
-        fits_report_error(stderr, status);
-    }
-    else 
-        this->logger->print(this->logger, MSG_DEBUG, "Fits", "Closed FITS file '%s'\n", this->path);
+    // if there is a file to close, then close it
+    if (this->file != NULL) {
+
+        int status = 0;
+
+        if (fits_close_file(this->file, &status)) {
+
+            this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to close FITS file '%s'\n", this->path);
+            fits_report_error(stderr, status);
+        }
+        else 
+            this->logger->print(this->logger, MSG_INFO, "Fits", "Closed FITS file '%s'\n", this->path);
+    }
 
     free(this);
