patch 8.2.1966: popup becomes current window after closing a terminal window

Problem:    Popup becomes current window after closing a terminal window.
Solution:   When restoring the window after executing autocommands, check that
            the window ID is still the same.  (Naruhiko Nishino,
            closes #7272)
diff --git a/src/window.c b/src/window.c
index 2cd0663..501ea84 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1461,6 +1461,21 @@
 }
 
 /*
+ * Find window "id" in the current tab page.
+ * Return NULL if not found.
+ */
+    win_T *
+win_find_by_id(int id)
+{
+    win_T   *wp;
+
+    FOR_ALL_WINDOWS(wp)
+	if (wp->w_id == id)
+	    return wp;
+    return NULL;
+}
+
+/*
  * Check if "win" is a pointer to an existing window in any tab page.
  */
     int