In a topology group $G$, an open subgroup $H$ is also closed. The proof of this statement is not hard: $G=\bigcup_{g_i} g_iH$ is a disjoint union of open left cosets, where $\{g_i\}$ is a complete representatives set of $G/H$. Then $\bigcup_{g_i \ne 1}g_iH$ is open and $H=G-\bigcup_{g_i \ne 1}g_iH$ is the complement of an open set, and therefore $H$ is closed. In this post, I will prove a slightly more general theorem:

Theorem. Let $G$ be a topological group. If $H$ is a locally closed subgroup in $G$, then $H$ is closed.

We will see that an open subgroup $H$ is locally closed, so it’s closed by the Theorem. Before the proof of the Theorem, let’s talk about locally closed sets first.

Definition. Let $X$ be a topological space and $S$ be a subset of $X$. $S$ is called locally closed, if for any point $s \in S$, there exists a neighborhood $U$ of $s$ in $X$ such that $S \cap U$ is closed in $U$.

Remark. Let $X$ be a topological space and $S$ be a subset of $X$. If $S$ is open, then for any $s \in S$, there exists an open neighborhood $U$ of $s$ in $X$ such that $U \subset S$. But this implies $S \cap U=U$ is closed in $U$, so $S$ is locally closed. This shows any open set is locally closed. Hence, if $H$ is an open subgroup in a topological group $G$, then $H$ is forced to be closed by the Theorem.

Proposition 1. Let $X$ be a topological space and $S$ be a subset of $X$. Let $\overline{S}$ be the closure of $S$ in $X$. Then the following are equivalent.
(1) $S$ is locally closed.
(2) $S$ is open in $\overline{S}$.
(3) $S$ is an intersection of an open set and a closed set.

Proof. (1)$\Longrightarrow$(2): Suppose $S$ is locally closed. For any $s \in S$, since $S$ is locally closed, there exists a neighborhood $U$ of $s$ in $X$ such that $U \cap S$ is closed in $U$. Let $V$ be the open set containing $s$ in $U$, then $V \cap S$ is also closed in $V$. Since $V$ is open, $V \cap \overline{S}$ is the closure of $V \cap S$ in $V$, so $V \cap \overline{S} = V \cap S \subset S$. Hence, we find an open neighborhood $V \cap \overline{S}$ of $s$ in $\overline{S}$ that is contained in $S$, so $S$ is open in $\overline{S}$.

(2)$\Longrightarrow$(3): Suppose $S$ is open in $\overline{S}$. Then there exists an open set $U$ in $X$ such that $S = U \cap \overline{S}$. Therefore, $S$ is an intersection of an open set and a closed set.

(3)$\Longrightarrow$(1): Suppose $S=U \cap C$, where $U$ is open and $C$ is closed. Then for any $s \in S$, take $U$ as the neighborhood of $s$ in $X$, then $U \cap S=U \cap U \cap C=U \cap C$ is closed in $U$, because $C$ is closed. Hence, $S$ is locally closed. $\square$

Proposition 2. Let $X$ be a Hausdorff topological space. If $S$ is a locally compact subspace in $X$, then $S$ is locally closed.

Proof. For any $s \in S$, since $X$ is Hausdorff and $S$ is locally compact, there exists an open set $U$ containing $s$ in $X$ such that $\overline{U} \cap S$ is compact in $S$, where $\overline{U}$ is the closure of $U$ in $X$. In particular, it is compact in $X$. Therefore, $\overline{U} \cap S$ is closed in $X$. Then $U \cap S = U \cap (\overline{U} \cap S)$ is closed in $U$. Hence, $S$ is locally closed. $\square$

We need some lemmas before going into the proof of the Theorem.

Lemma 1. Let $G$ be a topological group and $H$ be a subgroup in $G$, then $\overline{H}$, the closure of $H$ in $G$, is a closed subgroup of $G$.

Pf. Clearly, $\overline{H}$ is closed. It remains to prove $\overline{H}$ is a subgroup, i.e., for $a, b \in \overline{H}$, we need to show $a^{-1} \in \overline{H}$ and $ab \in \overline{H}$.

Let $a \in \overline{H}$. Since $g \mapsto g^{-1}$ is homeomorphism of $G$ to itself, for any open neighborhood $U$ of $a^{-1}$ in $G$, $U^{-1}=\{u^{-1}: u \in U\}$ is an open neighborhood of $a$. Then $(U^{-1}-\{a\}) \cap H \ne \varnothing$, since $a \in \overline{H}$. Therefore, $(U-\{a^{-1}\}) \cap H \ne \varnothing$, which means $a^{-1} \in \overline{H}$.

Let $a, b \in \overline{H}$. Since $m: G \times G \to G$ defined by $m(xy)=xy$ is continuous, for any open neighborhood $U$ of $ab$ in $G$, $m^{-1}(U)$ is open in $G \times G$. Since $ab \in U$, $(a, b) \in m^{-1}(U)$, there there exists $V$ and $W$, open neighborhood of $a$ and $b$ respectively, such that $V \times W \subset m^{-1}(U)$. Since $a, b \in \overline{H}$, $(V-\{a\}) \cap H \ne \varnothing$ and $(W-\{b\}) \cap H \ne \varnothing$, so $({m(V \times W)-ab}) \cap H \ne \varnothing$. Therefore, $(U-\{ab\}) \cap H \ne \varnothing$. This shows $ab \in \overline{H}$. $\vartriangleleft$

Lemma 2. Let $X$ be a topological space. Let $U$ and $V$ be two open dense subsets in $X$, then $U \cap V$ is also open dense in $X$. In particular, $U \cap V \ne \varnothing$.

Pf. Since $U$ and $V$ are open, so is $U \cap V$. For any $x \in X$, for any open neighborhood $W$ of $x$, since $U$ is dense, $U \cap W$ is a nonempty open set. Hence, $U \cap V \cap W$ is nonempty, because $V$ is dense. Therefore, $U \cap V$ is open dense in $X$. $\vartriangleleft$

Proof of the Theorem. Let $\overline{H}$ be the closure of $H$ in $G$. $\overline{H}$ is a subgroup by Lemma 1. Because $H$ is locally closed, we can apply the Proposition 1 above to conclude that $H$ is open dense in $\overline{H}$. Suppose $H \ne \overline{H}$, then $\overline{H}= \bigcup_{g_i} g_i H$, a disjoint union of left cosets of $H$ in $\overline{H}$. Since $H \ne \overline{H}$, there exists at least two disjoint left cosets. But $H$ is open dense in $\overline{H}$, all its left cosets are also open dense in $\overline{H}$, so by Lemma 2, any two of them have nonempty intersection, which contradicts the fact that they are disjoint. Hence, $H=\overline{H}$, so $H$ is closed. $\square$

Corollary. Let $G$ be a topological group and $H$ be a subgroup of $G$. Then if either one of the following conditions holds, then $H$ is closed:
(1) $H$ is an open subgroup;
(2) $G$ is a $T_1$ space and $H$ is discrete;
(3) $G$ is a Hausdorff space and $H$ is locally compact.

Proof. (1) See Remark above.

(2) If $G$ is $T_1$, then sets containing single point are closed, so discrete sets are locally closed. Hence, $H$ is locally closed, and therefore closed.

(3) This follows immediately from Proposition 2 and the Theorem. $\square$