Only add trailing semicolon if source file does not have one already

A trailing semicolon only needs to be added if the source file does not have one already, e.g.
input like `a.js` with `var a = true;` and `b.js` with `var b = true;` ends up being
```javascript
var a = true;

;var b = true;

;
```

instead of
```javascript
var a = true;

var b = true;
```
This PR fixes this.