Hi Oliver,
While we can track the logical kind of reason why something was closed (e.g. Close, CloseAllDocuments, etc.), we can't differentiate the source location of the close, such as between a programmatic Close (one you would call) vs. one triggered by a Close button. Both of those flow down through the same Close method. The button fires the CloseCommand, which calls the Close method. All close buttons in UI and menus work the same.
It seems like you would have to track this on your end. What if you made an extension method that did the logic mentioned in our previous reply and have all your spots in the code that close tool windows programmatically use that instead of the normal Close method?