Appends a newline at EOF / truncates off superfluous ones