graceful shutdown when using automatic service