I have packaged the destroyServer function to run cleanup for my mod, but for some reason destroyServer doesn't seem to be called all the time anymore.
It could be a few things.
Currently there's a problem with packages where they aren't unloading properly, causing some things to not be called correctly.
More likely though, in destroyServer the packages might already be unloaded by the time it gets to your function.
I just looked into it, it seems like at the end of destroyServer DeactivateServerPackages is called, so you could try putting your commands before calling the parent::destroyServer();