updated for version 7.3.545
Problem:    When closing a window or buffer autocommands may close it too,
            causing problems for where the autocommand was invoked from.
Solution:   Add the w_closing and b_closing flags.  When set disallow ":q" and
            ":close" to prevent recursive closing.
diff --git a/src/structs.h b/src/structs.h
index 921a049..abcb704 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1201,6 +1201,10 @@
 typedef struct qf_info_S qf_info_T;
 #endif
 
+/*
+ * These are items normally related to a buffer.  But when using ":ownsyntax"
+ * a window may have its own instance.
+ */
 typedef struct {
 #ifdef FEAT_SYN_HL
     hashtab_T	b_keywtab;		/* syntax keywords hash table */
@@ -1290,6 +1294,10 @@
     int		b_nwindows;	/* nr of windows open on this buffer */
 
     int		b_flags;	/* various BF_ flags */
+#ifdef FEAT_AUTOCMD
+    int		b_closing;	/* buffer is being closed, don't let
+				   autocommands close it too. */
+#endif
 
     /*
      * b_ffname has the full path of the file (NULL for no name).
@@ -1853,6 +1861,10 @@
     win_T	*w_prev;	    /* link to previous window */
     win_T	*w_next;	    /* link to next window */
 #endif
+#ifdef FEAT_AUTOCMD
+    int		w_closing;	    /* window is being closed, don't let
+				       autocommands close it too. */
+#endif
 
     frame_T	*w_frame;	    /* frame containing this window */