Finite-size scaling for the correlation function of the spherical model with long-range interactions