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

Fixes #6730
We should never throw warnings in the framework: only catchable exceptions.