patch 8.2.2465: using freed memory in :psearch

Problem:    Using freed memory in :psearch. (houyunsong)
Solution:   Check the current window is still valid.  Fix flaky test.
diff --git a/src/search.c b/src/search.c
index 3a4d458..d8c21f4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3864,6 +3864,8 @@
 #if defined(FEAT_QUICKFIX)
 			if (g_do_tagpreview != 0)
 			{
+			    if (!win_valid(curwin_save))
+				break;
 			    if (!GETFILE_SUCCESS(getfile(
 					   curwin_save->w_buffer->b_fnum, NULL,
 						     NULL, TRUE, lnum, FALSE)))