Ensure that last line of output file is always newline terminated