Improved newline handling so that "}" also ends a single line comment