Dispersion Function and Closed Orbit Distortion in Accelerator Rings