Modeling the Cavity Q for a Limited Number of Photonic-Crystal Layers