safer shutdown for daemon