diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index a64af65c20c48664f2398b98fff6325d7bdaad8c..772f9ac5bf7fb2bebf6535598db2a1ca0ecb35ec 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -99,7 +99,8 @@ def run():
                 try:
                     h5f = h5py.File(clvr_file, 'r')
                 except Exception:
-                    h5f.close()
+                    if h5f is not None:
+                        h5f.close()
                     print('Problem with file: ', clvr_file)
                     continue
                 if last_h5f is not None: