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
Merge pull request #2260 from som-snytt/issue/5717-assert-pkgdir

SI-5717 error when bytecode cannot be written