[Core] Fix crash on shutdown related to unloading SD2 library

Would be nice if someone could test and confirm this one.