chore(task): throw exception if the thread was terminated