I’ve been able to solve it. I don’t know what was wrong but I rewrote the entire code. Can a feature be added where you can have more than one iterator, discarding transactions automatically closes the iterator associated with it and delete an item from an iterator?