patch 9.0.0294: crash when 'cmdheight' is 0 and popup_clear() used

Problem:    Crash when 'cmdheight' is 0 and popup_clear() used.
Solution:   Reset "message_win" when the message popup is cleared.  Close the
            popup when 'cmdheight' is non-zero.  Add a screendump test.
diff --git a/src/popupwin.c b/src/popupwin.c
index 68ec64a..0cccf4a 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -28,6 +28,11 @@
     {"center", POPPOS_CENTER}
 };
 
+#ifdef HAS_MESSAGE_WINDOW
+// Window used for messages when 'winheight' is zero.
+static win_T *message_win = NULL;
+#endif
+
 static void popup_adjust_position(win_T *wp);
 
 /*
@@ -2770,6 +2775,11 @@
 	clear_cmdline = TRUE;
     win_free_popup(wp);
 
+#ifdef HAS_MESSAGE_WINDOW
+    if (wp == message_win)
+	message_win = NULL;
+#endif
+
     redraw_all_later(UPD_NOT_VALID);
     popup_mask_refresh = TRUE;
 }
@@ -4440,9 +4450,6 @@
 
 #if defined(HAS_MESSAGE_WINDOW) || defined(PROTO)
 
-// Window used for messages when 'winheight' is zero.
-static win_T *message_win = NULL;
-
 /*
  * Get the message window.
  * Returns NULL if something failed.
@@ -4516,6 +4523,16 @@
 	popup_hide(message_win);
 }
 
+/*
+ * If the message window exists: close it.
+ */
+    void
+popup_close_message_win(void)
+{
+    if (message_win != NULL)
+	popup_close(message_win->w_id, TRUE);
+}
+
 #endif
 
 /*