SI-5717 error when bytecode cannot be written

If there's an existing file foo when emitting a class file for foo.Bar,
then emit an error at foo.Bar, similar to what javac does.

The error message looks something like:

foo.scala:4: error: error writing object Foo: ./mypkg/Foo.class: ./mypkg is not a directory