Windows: make openTempFile fully atomic.
Previous fix for #10731 (closed) made the creation of the temp file atomic and threadsafe but the rename was not made atomic.
This is because by default
MoveFileW schedules a rename, but doesn't guarantee that the operation is completed immediately.
We now pass write-through as a flag, forcing it to wait till the change has been written. If the rename fails we retry the whole process up to a set maximum.
Fixes #10731 (closed)