Saves the resources to the output stream and then closes it.
ResourceWriter.Generate is called implicitly by ResourceWriter.Close, if required.