Closes the service and releases any held resources. Should be called when the service is no longer needed.