try to gracefully shutdown