[FIX] Close opened files and open XMLs in binary mode

Close various files which have just been open. Also verify that
the XmlDump instance can not just handle uncompressed UTF-8 files.

Contains also one unrelated assertEqual(s) fix.

Bug: 70969
Bug: 70977
Change-Id: Ic8454d0d1cc8c98458611efca32bbcd90620df12
Merge "[FIX] Close opened files and open XMLs in binary mode"