writer: Implement xmlTextWriterClose This function can be used to make sure that closing the output stream succeeded. Fixes #513.