call file_close on file before reopening