Use format() in run()

1. format() was incomplete and didn’t close the formatter or the writer
2. run() didn’t use format(), leading to duplicate code (or would-be
   duplicate, if it wasn’t missing, see 1.)
Add error recovery

In case of exception, rewrite the original content. This seems to work
because the ANTLRFileStream apparently buffers the entire file in
memory.

Implements and closes #42.