Characterisation and compensation of magnetic distortions for the pixel Hybrid Photon Detectors of the LHCb RICH