close file after finishing the program