@Test
void testDoubleClose() {

    final AtomicInteger cnt = new AtomicInteger();
    final Stream<Integer> stream = Stream.of(0, 1).onClose(cnt::incrementAndGet);
    stream.close();
    stream.close();
    assertEquals(1, cnt.get());
}