Impedance matching in photonic crystal microcavities for second-harmonic generation