code: public static <T> T withWriter(File file, @ClosureParams(value = SimpleType.class, options = "java.io.BufferedWriter") Closure<T> closure) throws IOException {
          return IOGroovyMethods.withWriter(newWriter(file), closure);
      }
docs: Creates a new BufferedWriter for this file, passes it to the closure, and
  ensures the stream is flushed and closed after the closure returns.
  
  @param file    a File
  @param closure a closure
  @return the value returned by the closure
  @throws IOException if an IOException occurs.
  @since 1.5.2