Fixes #6730 : close() xml reader on fromFile() and fromString()

Fixes #6730
Ping @NikolayFilatov: can you eventually think of how you discovered the issue?