Panel: Retain current page during closing process

Fixes gh-7814
Closes gh-7877