docs: @SuppressWarnings("unchecked")
      protected <T extends Closeable> void forEachCloseable(Predicate<? super Closeable> selector, Consumer<T> function) {
          for (Closeable c : closeableResources) {
              if (selector.test(c)) {
                  function.accept((T) c);
              }
          }
      }