code: private void flushInternal() throws IOException {
      isClosed();
      dfsClient.checkOpen();
  
      long toWaitFor;
      synchronized (this) {
        enqueueCurrentPacket();
        toWaitFor = lastQueuedSeqno;
      }
  
      waitForAckedSeqno(toWaitFor);
    }
docs: Waits till all existing data is flushed and confirmations
  received from datanodes.