Handle errors when compacting broken db. Refs #1062.

Adds handler for `error` event on compaction allowing dbs with errors to be handled gracefully.

cc @springmeyer @BergWerkGIS