Canceling threads at the end.