A high-order spectral method for the multi-term time-fractional diffusion equations