Issue 13414 - Static destructors not called correctly with dynamic loading

Patch provided by Niklas Wallén in private correspondence. Thanks!

https://issues.dlang.org/show_bug.cgi?id=13414
@MartinNowak: Ping.