Quantum theory of a two-mode open-cavity laser