Switched to using TextWriter instead of Stream. ScriptTag no longer self closing