Don't append the output file
flush the buffer before we close