catch Throwable instead to prevent Errors from causing lockups in shutdown