Correctly handle trailing semicolons and more fixtures

Up to this change a trailing semicolon created a superfluous newline, while the semicolon should just have been removed. This is how it is done now.