Fix an issue with writing progress in another thread