TITLE: In a compact lie group, can two closed connected subgroups generate a non-closed subgroup?
QUESTION [15 upvotes]: Let $H$,$K$ be closed connected subgroups of a compact Lie group $G$.  Let $L:=\langle H,K \rangle$ be the subgroup they generate, ie, the smallest subgroup of $G$ containing them both.  Must $L$ be closed?
Notes:

False if $G$ is not compact.
False if $H$, $K$ not connected: consider two $\mathbb{Z}/2\mathbb{Z}$ subgroups in $O(2)$ generated by reflections in irrationally related axes.

Is there a way to jack up (2) to a connected counterexample, for instance?

REPLY [12 votes]: Maybe it's helpful to formulate a somewhat different version of Mikhail's answer, from the viewpoint of the Borel-Tits development of reductive algebraic groups over an arbitrary field.    When the field is $\mathbb{R}$, much of the basic structure of Lie groups is recaptured this way including the structure of compact connected Lie groups: such a group is always the group of real points of a connected reductive algebraic group over $\mathbb{C}$.   (The book by Onishchik and Vinberg captures much of the information, but at the cost of leaving most proofs as structured exercises and working always over a base field of characteristic 0.    The main ideas for algebraic groups work in much more generality.)
In the early part of Borel's book Linear Algebraic Groups you find in I.2.2 a general formulation which implies in particular that the answer to the question asked here is yes.   (Indeed, $L$ is connected as well as closed.)    The treatment in 7.5 of my book with the same title is a little more explicit, but doesn't refer to fields of definition since those are deferred to the end of the book.   As far as I know there is no completely explicit formulation for compact Lie groups in the textbook literature, though I hope I'm wrong.    
Unfortunately there seems to be no self-contained textbook treatment of the structure of compact Lie groups, though the representation theory is treated for example in the Springer GTM by Brocker and tom Dieck.   Instead, compact Lie groups are typically discussed as special cases of more general Lie groups in larger books.