Close the file after opening it