close file after getting context