Always end the ini string with a single newline

even for sections with a payload
Fix filling in of section array refs
Put only one blank line between sections with payloads
Test single line ending without payloads
Document recent bug fixes