fix graceful close case when no messages are in-flight