patch 8.2.2248: ASAN error on exit with GUI

Problem:    ASAN error on exit with GUI.
Solution:   Check the window still has lines. (Christian Brabandt,
            closes #7573)
diff --git a/src/term.c b/src/term.c
index bb4bad1..9e9a67b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3411,9 +3411,10 @@
 	return;
 
     // curwin->w_buffer can be NULL when we are closing a window and the
-    // buffer has already been closed and removing a scrollbar causes a resize
-    // event. Don't resize then, it will happen after entering another buffer.
-    if (curwin->w_buffer == NULL)
+    // buffer (or window) has already been closed and removing a scrollbar
+    // causes a resize event. Don't resize then, it will happen after entering
+    // another buffer.
+    if (curwin->w_buffer == NULL || curwin->w_lines == NULL)
 	return;
 
     ++busy;