Clean up XML writing.