proper daemon shutdown