code: public static <E> Stream<E> stream(CloseableSpliterator<E> spliterator, boolean parallel) {
        Stream<E> stream = StreamSupport.stream(spliterator, parallel);
        stream.onClose(spliterator::close);
        return stream;
     }
docs: Creates a stream that when closed will also close the underlying spliterator
  @param spliterator spliterator to back the stream and subsequently close
  @param parallel whether or not the returned stream is parallel or not
  @param <E> the type of the stream
  @return the stream to use