save the file and then close it