Happens for renders from command line, when kernel specialization thread is still working after the allocators on the Blender side have been deinitialized. Add an explicit deinitializaiton, which ensures all Cycles worker and cache threads are finished before the allocators are deinitialized. This should solve occasional crashes when running regression tests for Metal or Metal-RT. Pull Request: https://projects.blender.org/blender/blender/pulls/128239