Actually, this function has two different approaches depending on whether or not it was called with NULL (though I think its a bit of a strange design, ideas appreciated!).

If specified_tracefile is non-null, then this means that we want to write all coverage data to a single file. So we just ref that file and return it (making sure the write pointer is at the end).

If it is null, then it means that we want to write to $(filename).js.info. So we have to create a new file (and thus a new output stream) and return that.

In any event, unreferencing the returned output stream will Do the Right Thing[tm]. So this function is more or less an abstraction. "I may or may not have a specific trace file. Give me an output stream that does the right thing".