finish coroutine when task killed or timeout. make sure all resource in local variable be released correctly.