Fix exit crash