flushing buffer when queue is present