code: private Stream<?> mixinWithCloseHandler(Stream<?> resultStream, Runnable closeHandler){
  		resultStream.onClose(closeHandler);
  		InvocationHandler ih = new InvocationHandler() {
  			@Override
  			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
  				Object result = method.invoke(resultStream, args);
  				if (Stream.class.isAssignableFrom(method.getReturnType())){
  					Stream<?> stream = (Stream<?>) result;
  					result = mixinWithCloseHandler(stream, closeHandler);
  				}
  				return result;
  			}
  		};
  
  		return (Stream<?>) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Stream.class}, ih);
  	}
docs: Creates proxy over the result Stream to ensures that close() call is always delegated to
  the close handler provided by the target ExecutionDelegate.