Save events to a single trace file.

Resolves #930.

There was a fencepost bug here that I didn't feel was worth fixing.