PluginInitializer leads to: Failed to activate view "Editor"

I created a plugin that just has a message box in the Application.Closing event of the PluginInitializer, asking if I want to close Studio. and sets e.Cancel to true.

If I do this (cancelling the closing of Studio) while a document is open in the editor view, I get the error message mentioned above when trying to activate the editor view and have to restart Studio. If the editor is empty before trying to close Studio, all seems to work fine. Has anyone had a similar problem before and knows a solution?