Improved XML error handling and fixed bug on file close.