ENH: Improve error message for PeriodIndex to infer_freq. Closes #5841.

Minor clean-up for #5841. I'm still not sure we shouldn't just return `freq` if a PeriodIndex is given. Seems easy enough.