Defer shutdown to more gracefully handle error conditions