Aspect-ratio dependence of the transition to the ultimate state of turbulent Rayleigh-Bénard convection