Fix graceful shutdown logic

Resolve bug #1081367
Merge pull request #5146 from ironcladlou/graceful-stop-fix

Merged by openshift-bot