When finished downloading, explicitly cancel the heartbeat thread

We must be careful to not leave the control channel in a bad state,
so we cancel an Lwt.task, and use Lwt.pick [ task; sleep ] to cancel
only between heartbeats.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
HTTP GET and PUT: tell the server when the transfer succeeds

Signed-off-by: David Scott <dave.scott@eu.citrix.com>