Method to call when the task has ended. If never called, the service won't terminate while otherwise idle.