Ensure valid xml on overwriting a longer result file
Ensure valid xml on overwriting a longer result file

[File.OpenWrite][doc] doesn't zero out the content of the file if it already exists.

This may generate invalid xml when the newly generated xml takes less space to be serialized
than the existing xml content of the file.

Additionally, this commit also takes care of releasing the file handle as soon as possible.



 [doc]: https://msdn.microsoft.com/en-us/library/system.io.file.openwrite
Faizan2304/LoggerExtensions