wrote distances csv