A more accurate analytic calculation of the spectrum of cosmological perturbations produced during inflation