Controlling the stability of nonlinear optical modes via electromagnetically induced transparency