Loop Corrections to the Training and Generalization Errors of Random Feature Models