Fix trailing newlines in generated keys.