WindowPane: Fix NPE in modal overlay handling when component is unregistered

When a window pane is unregistered, its application reference is set to null,
which was not checked for in the modal change callbacks later on.

The bug was confirmed and the fix tested in the scenario described in issue #77

Fixes #77