Cleanup newlines for writing settings:

• We don't need newlines before settings, but we do need them after them.

• This makes it so there aren't extra newlines in newly saved settings from
  the UI, as well as making it such that the file ends in a newline as it
  should.
(cherry picked from commit ff712674b630d627421f6fd391dd7d560d75d4e4)