stop service before exiting.