XML writer task progress update off by one loop iteration