Closing Plugin Panels

We’ve recently swapped to having users add a custom package repository pointing to a folder with our yak packages (as described here: Rhino - Custom Package Repositories) and enabling “Automatically update packages when Rhino starts” in the PackageManager dialog. Previously we just got them to drag and drop the .yaks.

The issues we’re coming up against is that it seems if the user had any of our plugin panels open in Rhino, when Rhino restarts the panels are loaded, which loads the old plugin version before PackageManager can install/load the new plugin? Seems very similar to this post here: Docked webview panels throw plugin id already in use on Yak update - #8 by will and I’ve confirmed the plugin does update correctly if the panels are closed.

Initially I thought swapping the plugin to use PlugInLoadTime.WhenNeededIgnoreDockingBars would fix it but unless I’m misunderstanding what its suppose to do, its not working?

I then thought I’d just close all the panels when Rhino shuts down using the plugins protected override void OnShutdown() but this isn’t working (I swear it use to work in Rhino7, but maybe I’m misremembering?). Also tried using RhinoApp.Closing event but also didn’t work. I wondered if the closing the panels isn’t enough and we have to trigger a save to the schema or something to save the layout?

Any suggestions for this? Am I just doing something dumb?