diff --git a/tests/test_OFStream.cpp b/tests/test_OFStream.cpp
index 2ea0615c87aac0d519b62d47b33392a022d9a10d..ecbab1edcd4e8e3e8d566803290e8aa25e61fd06 100644
--- a/tests/test_OFStream.cpp
+++ b/tests/test_OFStream.cpp
@@ -42,10 +42,40 @@ TEST_CASE("OFStream", "[language]")
 
       std::string content = file_content;
       REQUIRE(content == "foo3 bar\n");
+    }
+
+    // Ensures that the file is closed after this line
+    std::make_shared<OFStream>(filename, true) << "new content\n";
 
-      std::filesystem::remove(filename);
+    if (parallel::rank() == 0) {
+      REQUIRE(std::filesystem::is_regular_file(filename));
+
+      std::ifstream is(filename);
+
+      char file_content[21];
+      int count = 0;
+      for (size_t i = 0; i < 21; ++i) {
+        char c = is.get();
+
+        file_content[i] = c;
+        if (c == '\n') {
+          count++;
+          if (count == 2) {
+            file_content[i + 1] = '\0';
+            REQUIRE(i == 20);
+
+            c = is.get();
+            REQUIRE(is.eof());
+            break;
+          }
+        }
+      }
+
+      std::string content = file_content;
+      REQUIRE(content == "foo3 bar\nnew content\n");
     }
 
+    std::filesystem::remove(filename);
     REQUIRE(not std::filesystem::exists(filename));
   }