changed exit timing to avoid hand on shutdown