patch 7.4.2212
Problem:    Mark " is not set when closing a window in another tab. (Guraga)
Solution:   Check all tabs for the window to be valid. (based on patch by
            Hirohito Higashi, closes #974)
diff --git a/src/buffer.c b/src/buffer.c
index 2a09a63..4f68882 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -475,7 +475,7 @@
 
     if (win != NULL
 #ifdef FEAT_WINDOWS
-	&& win_valid(win)	/* in case autocommands closed the window */
+	&& win_valid_any_tab(win) /* in case autocommands closed the window */
 #endif
 	    )
     {
@@ -581,7 +581,7 @@
 
     if (
 #ifdef FEAT_WINDOWS
-	win_valid(win) &&
+	win_valid_any_tab(win) &&
 #else
 	win != NULL &&
 #endif