patch 8.0.1160: getting tab-local variable fails after closing window

Problem:    Getting tab-local variable fails after closing window.
Solution:   set tp_firstwin and tp_lastwin. (Jason Franklin, closes #2170)
diff --git a/src/window.c b/src/window.c
index a290807..96e32d8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4775,13 +4775,14 @@
     if (wp->w_prev != NULL)
 	wp->w_prev->w_next = wp->w_next;
     else if (tp == NULL)
-	firstwin = wp->w_next;
+	firstwin = curtab->tp_firstwin = wp->w_next;
     else
 	tp->tp_firstwin = wp->w_next;
+
     if (wp->w_next != NULL)
 	wp->w_next->w_prev = wp->w_prev;
     else if (tp == NULL)
-	lastwin = wp->w_prev;
+	lastwin = curtab->tp_lastwin = wp->w_prev;
     else
 	tp->tp_lastwin = wp->w_prev;
 }
@@ -6597,11 +6598,11 @@
  */
     int
 switch_win(
-    win_T	**save_curwin UNUSED,
-    tabpage_T	**save_curtab UNUSED,
-    win_T	*win UNUSED,
-    tabpage_T	*tp UNUSED,
-    int		no_display UNUSED)
+    win_T	**save_curwin,
+    tabpage_T	**save_curtab,
+    win_T	*win,
+    tabpage_T	*tp,
+    int		no_display)
 {
 # ifdef FEAT_AUTOCMD
     block_autocmds();