Fixed crash when exiting level editor.