docs: public static <T> T withWriter(Writer writer, @ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
          try {
              T result = closure.call(writer);
  
              try {
                  writer.flush();
              } catch (IOException e) {
                  // try to continue even in case of error
              }
              Writer temp = writer;
              writer = null;
              temp.close();
              return result;
          } finally {
              closeWithWarning(writer);
          }
      }