Remove trailing newlines from snippets