Fix the exception handling for cleanup tasks in ClosingIterator