updated for version 7.0-227
diff --git a/src/version.c b/src/version.c
index f19fbba..dc85d40 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    227,
+/**/
     226,
 /**/
     225,
diff --git a/src/window.c b/src/window.c
index 40aa2f0..28b9660 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2084,6 +2084,13 @@
     }
 #endif
 
+#ifdef FEAT_GUI
+    /* Avoid trouble with scrollbars that are going to be deleted in
+     * win_free(). */
+    if (gui.in_use)
+	out_flush();
+#endif
+
     /*
      * Close the link to the buffer.
      */
@@ -4174,7 +4181,6 @@
 #ifdef FEAT_GUI
     if (gui.in_use)
     {
-	out_flush();
 	gui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_LEFT]);
 	gui_mch_destroy_scrollbar(&wp->w_scrollbars[SBAR_RIGHT]);
     }