Make sure all services are stopped properly

Close #663