code: public static void close(Iterable<? extends Closeable> closeables)
              throws IOException {
          IOException first = null;
          for (final Closeable c : closeables) {
              if (c == null) {
                  LOG.debug("trying to call .close() on null reference");
                  continue;
              }
              try {
                  c.close();
              } catch (final IOException e) {
                  if (first == null) {
                      first = e;
                  } else {
                      first.addSuppressed(e);
                  }
              }
          }
          if (first != null) {
              throw first;
          }
      }
docs: Closes the given Closeables and collects all occurring exceptions as
  suppressed exception to the exception that occurred first.
  
  @param closeables The Closeables to close.
  @throws IOException If any of them throws an IOException.