panel: Correctly handle window closing

We previously didn't handle maximize state tracking for windows about to
close, therefore our max_count would never reset, and the panel would remain
dark until it had been restarted.
We now ensure we track the closing state, and the previous functionality
for obtaining our parent toplevel and notifiying the BudgiePanel instance
has been refactored into a private function.