Improve service_block with service_stopped block to cleanly terminate service