Fix crashing on app close, because the wrapper cache would be destroyed before the preferences