diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py
index b3aad36d7b338fe488dbdee8870a7589c083679f..669c05c0bc3e019b099e4357e69ae07534318862 100644
--- a/src/robofish/io/file.py
+++ b/src/robofish/io/file.py
@@ -130,7 +130,7 @@ class File(h5py.File):
 
     def __exit__(self, type, value, traceback):
         # Check if the context was left under normal circumstances
-        if (type, value, traceback) is (None, None, None):
+        if (type, value, traceback) == (None, None, None):
             self.validate()
             self.close()