proper shutdown path