[Test] make sure to close the file at the end of the test