flush batches before disconnection