>>| wait "Waiting for the channels to empty" (\(r,s,ss)->isEmpty s) (channels d)
>>| upd (\(r,s,ss)->(r,s,True)) (channels d)
>>| maybe (treturn ()) (flip removeTask topLevelTasks) d.deviceTask
>>| wait "Waiting for the channels to empty" (\(r,s,ss)->isEmpty s) (channels d)
>>| upd (\(r,s,ss)->(r,s,True)) (channels d)
>>| maybe (treturn ()) (flip removeTask topLevelTasks) d.deviceTask