Phase distortions of attosecond pulses produced by resonance-enhanced high harmonic generation