update iterators to use streaming and implement AutoClosable