Add an option to set a newline at end of file

It's common practice to end files with a newline at the end of file. This PR adds an option to set a single `\n` at EOF when writing the file.