Fix shutdown bug in cocos2d.