handle deliberate shutdown