Fix issue with WaitForProvisionTask that could end prematurely. Improve handling of timeout.