script recording: Merge adjacent writes

Merge multiple write records into one if they are less than 10 ms apart.