Updated graceful application shutdown