Properly report errors and shut down
Closes #12