Fix crash on FreeLibrary