Fixed an issue when the top window is hidden because this is not the root window