implement grace period for shutdown