Strip trailing newlines