Pion photoproduction off the proton in a gauge-invariant chiral unitary framework