If the previous window no longer exists when Gedit is called, the attempt to change windows with 'wincmd p' fails and 'wincmd w' should be used instead.