The energetics of dislocation array stability in strained epitaxial layers