When unloading domains, free dynamic assemblies first, since they have no ref counting, so they can depend on static assemblies which are already freed. Fixes #12786.