When page is used as a hash-table key, take a reference to it to ensure that it stays alive until it is removed from the table.
Fixes #5917
Closes #5917