diff --git a/binarycpython/tests/test_grid.py b/binarycpython/tests/test_grid.py
index a3bee3a6b4e32b95c966ebe66c91e067615edcb4..352f89e7acbe67b92993c5004ff7bbf60ac3c0e5 100644
--- a/binarycpython/tests/test_grid.py
+++ b/binarycpython/tests/test_grid.py
@@ -27,6 +27,7 @@ TODO: Before running the non-unit tests to cover functions like evolve, we need
 import os
 import sys
 import json
+import gzip
 import unittest
 
 from binarycpython.utils.functions import (
@@ -343,7 +344,9 @@ class test_export_all_info(unittest.TestCase):
         # datadir
         settings_filename = test_pop.export_all_info(use_datadir=True)
         self.assertTrue(os.path.isfile(settings_filename))
-        with open(settings_filename, "r") as f:
+
+        # We currently export the file as a gzip file so we need to take that into accoutn
+        with gzip.open(settings_filename, "rb") as f:
             all_info = json.loads(f.read())
 
         #
diff --git a/binarycpython/utils/population_extensions/dataIO.py b/binarycpython/utils/population_extensions/dataIO.py
index 716e36ef91bbdd723fa64026e2731a781eb19e2f..bd1da06bc59924dfe5d4ad2907d267eaffd6ce47 100644
--- a/binarycpython/utils/population_extensions/dataIO.py
+++ b/binarycpython/utils/population_extensions/dataIO.py
@@ -666,14 +666,16 @@ class dataIO:
     def NFS_flush_hack(self, filename):
         """
         Use opendir()/closedir() to flush NFS access to a file.
+
         NOTE: this may or may not work!
 
         TODO: This function leads to a complaint about unclosed scandir operators. Check if that can be resolved.
         """
         os.sync()
         dirname = os.path.dirname(filename)
-        os.scandir(dirname)
-        os.scandir.close()
+
+        for _ in os.scandir(dirname):
+            pass
 
     def compression_type(self, filename):
         """