Add error catching

Catch error in handler() thread, print Exception, and close program