protected void close() {
      io.doAs(
          () -> {
            dataWriter.close();
            return null;
          });
      if (currentRows <= 0) {
        try {
          io.deleteFile(dataWriter.toDataFile().path().toString());
        } catch (UncheckedIOException e) {
          // the file may not have been created, and it isn't worth failing the job to clean up,
          // skip deleting
        }
      }
    }
a writer holder which require records had been sorted before write. The holder will hold only
one writer in open, and will throw an IllegalStateException exception if TaskWriter request a
data writer via a write key which has been already closed.
amoro-format-iceberg/src/main/java/org/apache/amoro/io/writer/BaseTaskWriter.java