Close file before exit main.