Reworked try/catch for taskcanceledexception.