close file after it is used.