code: public static <T, U extends AutoCloseable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws Exception {
          Throwable thrown = null;
          try {
              return action.call(self);
          } catch (Throwable e) {
              thrown = e;
              throw e;
          } finally {
              if (thrown != null) {
                  Throwable suppressed = tryClose(self, true);
                  if (suppressed != null) {
                      thrown.addSuppressed(suppressed);
                  }
              } else {
                  self.close();
              }
          }
      }
docs: Allows this AutoCloseable to be used within the closure, ensuring that it
  is closed once the closure has been executed and before this method returns.
  <p>
  As with the try-with-resources statement, if multiple exceptions are thrown
  the exception from the closure will be returned and the exception from closing
  will be added as a suppressed exception.
  
  @param self the AutoCloseable
  @param action the closure taking the AutoCloseable as parameter
  @return the value returned by the closure
  @throws Exception if an Exception occurs.
  @since 2.5.0