Make sure there's a line break before writing new key. Fixes #7409.