Stop a running task

Stops a running task. Resources are cleaned up and the task transitions to STOPPED status.