The `WT_CLEAR` is needed, or at least clearing `ref->page`, otherwise when the tree is discarded, the live pages will be freed.

You're right that page should be set iff `state == WT_REF_LOCKED`: I was being paranoid.  I'll fix.