Refactored exit process to hopefully reduce rate of stuck processes