Fix inconsistent use of `$this->writer` vs local variable
Merge pull request #488 from checat/consistent-xml-writer

Fix inconsistent use of `$this->writer` vs local variable