Panel: use self._off for panelclose instead of document.off

Fixes gh-7058
Closes gh-7260

(cherry picked from commit 3df9b3ba8f5b7b7ddc3e030666b931a5ff1cf48e)