Add an option to set a newline at end of file

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