code: public static void close(final Source input) throws IOException {
          if (input != null && input instanceof StreamSource) {
              final StreamSource s = (StreamSource) input;
              final InputStream i = s.getInputStream();
              if (i != null) {
                  i.close();
              } else {
                  final Reader w = s.getReader();
                  if (w != null) {
                      w.close();
                  }
              }
          }
      }
docs: Close source.