Closes the component writing stream.
This method will close any open XML elements, and then close the OutputFile if necessary.