Support for graceful shutdown