patch 9.0.0682: crash when popup with deleted timer is closed

Problem:    Crash when popup with deleted timer is closed. (Igbanam
            Ogbuluijah)
Solution:   Check the timer still exists. (closes #11301)
diff --git a/src/window.c b/src/window.c
index f63b856..8486f1a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5322,7 +5322,8 @@
 	    close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
     }
 # if defined(FEAT_TIMERS)
-    if (win->w_popup_timer != NULL)
+    // the timer may have been cleared, making the pointer invalid
+    if (timer_valid(win->w_popup_timer))
 	stop_timer(win->w_popup_timer);
 # endif
     vim_free(win->w_frame);