#6 Wrong window is selected as current after closing subdialog.

Fixes #6