Fixed potential memory leak in event stream.
Playing with different ways to write trace files.