Handle main/child window relation correctly when a application window is closed

Signed-off-by: Simon Busch <morphis@gravedo.de>