Reduced loop in writeSegments to include only spanners from the tick range.