how to stop an iterator