Fix free lifetime vars in HashMap's iterators

Fixes #17500