MY app is using a relatively slow datagrid to show some data. I found out that if I close many documents in a fast manner, the app crashes. Upon further investigation the MouseDown override on LayoutDocumentTabItem is the issue.
I propose adding a null check for the Layout item as shown in the image below:

I don't know what can cause the laylout item to be null at that given point in time.
Any suggestions are appreciated. I will place a PR in these days if @Dirkster99 approves ;)