Minor refactoring

Adds also a missing Close() call on the Unattend.xml
output stream.