Fix trailing newlines in snippets