Is every finite-dimensional Lie algebra the Lie algebra of a closed linear Lie group? This question is closely related to this one.
Ado's theorem states that given a finite-dimensional Lie algebra $\mathfrak g$, there exists a faithful representation $\rho\colon\mathfrak g \to \mathfrak{gl}(V)$, with $V$ a finite-dimensional vector space. In the real or complex case one can take the exponent of the image and obtain a (virtual) Lie subgroup $\exp\rho(\mathfrak g)$ in $GL(V)$ having Lie algebra $\rho(\mathfrak g)$. But nothing guarantees that this subgroup will be closed in $GL(V)$. 
So the question is: is every finite-dimensional Lie algebra the Lie algebra of some closed linear Lie group? I am primarily interested in the real and complex case, but it might be interesting to ask what happens in the ultrametric case as well.
 A: I think that the answer is yes.  It looks like you can prove it by relying on a convenient proof of Ado's theorem.
Procesi's book, "Lie groups: an approach through invariants and representations", has the following theorem preceding the proof of Ado's theorem:
Theorem 2.  Given a Lie algebra $L$ with semismiple part $A$, we can embed it into a new Lie algebra $L'$ with the following properties:


*

*$L'$ has the same semismiple part $A$ as $L$.

*The solvable radical of $L'$ is decomposed as $B' \oplus N'$, where $N'$ is the nilpotent radical of $L'$, $B'$ is an abelian Lie algebra acting by semisimple derivations, and $[A, B'] = 0$.

*$A \oplus B'$ is a subalgebra and $L' = (A \oplus B') \ltimes N'$.


With all of that, the idea is to first prove the refinement of Ado's theorem for $L'$.  We need a particular refinement:  Let $\tilde{A}$ be the maximal algebraic semisimple Lie group with Lie algebra $A$, and let $\tilde{B'}$ and $\tilde{N'}$ be the contractible Lie groups with  Lie algebras $B'$ and $N'$.  If we can find a closed embedding of $(\tilde{A} \times \tilde{B'}) \ltimes \tilde{N'}$ in a matrix group, then it will restrict to a closed embedding of the Lie subgroup of the original $L$.
In the proof of Ado's theorem that follows, the action of $N'$ is nilpotent, so the representation of $\tilde{N'}$ is closed and faithful.  The Lie algebra $L'$ has a representation which is trivial on $B'$ and $N'$ and generates $\tilde{A}$.  It has another representation which is trivial on $N'$ and $A$ and for which the action of $B'$ is nilpotent.  If I have not made a mistake, the direct sum of these three representations is the desired representation of $L'$.
A: The answer is yes. According to Ado's theorem,
every Lie algebra can be realized as subalgebra
of $\mathfrak{gl}(V)$ for some $V$.
According to the subalgebras-subgroups theorem,
every Lie subalgebra of $\mathfrak{gl}(V)$
is the Lie algebra of an immersed Lie subgroup of $\mathrm{GL}(V)$.
Call a Lie group linear if it admits a faithful representation.
We have shown that every Lie algebra is the Lie algebra
of a linear Lie group. It is known that every
linear Lie group $G$ admits a faithful representation
whose image is closed.
Here's a sketch of the proof of the last statement.
Let $r\colon G\rightarrow GL(V)$ be a faithful representation of $G$.
The derived group $r(G^{\prime})$ of $r(G)$ is closed $GL(V)$
and hence in $r(G)$. Hence
$G/G^{\prime}$ is an abelian Lie group. Therefore there exists a
representation $s\colon G\rightarrow GL(W)$ such that $Ker(s)=G^{\prime}$ and
$s(G)$ is closed in $GL(W)$. Consider the representation $G\rightarrow GL(V\oplus
W)$ such $a\in G$ acts on $V$ as $r(a)$ and on $W$ as $s(a)$. This is
faithful, and one can show that its image is closed --- Proposition 5 of
Djokovic, D. Ž. A closure theorem for analytic subgroups of real Lie groups. Canad. Math. Bull. 19 (1976), no. 4, 435--439. MR0442147
