Fix window close, fix positioning of new windows

See individual commit messages for details.

One patch makes the close button work again (it broke in commit 4eeca12).

The other fixes/enhances the _show function to position new windows correctly.