docs: public synchronized long endCopy(CopyOperationImpl op) throws SQLException {
      if (!hasLock(op)) {
        throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
      }
  
      try {
        LOGGER.log(Level.FINEST, " FE=> CopyDone");
  
        pgStream.sendChar('c'); // CopyDone
        pgStream.sendInteger4(4);
        pgStream.flush();
  
        do {
          processCopyResults(op, true);
        } while (hasLock(op));
        return op.getHandledRowCount();
      } catch (IOException ioe) {
        throw new PSQLException(GT.tr("Database connection failed when ending copy"),
            PSQLState.CONNECTION_FAILURE, ioe);
      }
    }