Bug fixes

Sourcemap changes broke compilation without a sourcemap, thought I'd
tested this. Hadn't. This is why I need to write some unit tests.

Also added some error handling so that the tmpdir is deleted even when
there's an error during compilation.