Fix bug where pressing escape would result in switching to the first window

(now if nothing is selected the window will not be switched)