Shutting down server does not wait for plugins to destroy

I need to clear resources on destroying my plugin.

When I remove plugin from admin console, all works correctly.

But when I shut down server, destroyPlugin method of my plugin only starts to execute (i see first strings in log) and then immediately the Openfire server is halted.

I saw related unanswered bug post: Shutdown (XMPPServer.Stop) never executed in openfire.exe? , but in my case, both running as openfire.exe and openfire-service produce same behaviour.

If this behaviour is as expected, then how can I write a true shutdown hook for Openfire?

Update: after looking in debug, the same happens: PluginManager#shutdown just enters plugin.destroyPlugin(), and meanwhile the server halts.

Openfire version: 3.9.3

OS: Windows 8 Professional x64.