Close output file, and flush.