Flush the queue when closing the handler [ci skip]