[TO_STAGE] Fix graceful shutdown logic

Resolve bug #1081367