remove trailing newlines