When closing the window, set the window to null