patch 8.2.4454: resetting cmdwin_type only for one situation

Problem:    Resetting cmdwin_type only for one situation.
Solution:   Reset cmdwin_type before closing windows. (closes #9822)
diff --git a/src/window.c b/src/window.c
index 7da7b89..ceb7d59 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2856,6 +2856,10 @@
 {
     int		dummy;
 
+#ifdef FEAT_CMDWIN
+    // avoid an error for switching tabpage with the cmdline window open
+    cmdwin_type = 0;
+#endif
     while (first_tabpage->tp_next != NULL)
 	tabpage_close(TRUE);