Close output file in main