diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py
index 5d5742ffd3f28d63e038178db0ab296927e6249e..6a836a6d0e438eb0acecb166bd2601c8de6e14b0 100644
--- a/src/robofish/io/file.py
+++ b/src/robofish/io/file.py
@@ -175,7 +175,7 @@ class File(h5py.File):
         if (type, value, traceback) == (None, None, None):
             if self.mode != "r":  # No need to validate read only files (performance).
                 self.validate()
-            self.close()
+        super().__exit__(type, value, traceback)
 
     def save_as(self, path: Union[str, Path], strict_validate: bool = True):
         """Save a copy of the file