I was thinking of a way to prove [this](https://math.stackexchange.com/questions/586862/non-vanishing-vector-fields-on-non-compact-manifolds) and I realised that for my approach the lemma from the title would be useful, and it´s an interesting question on its own. Obviously it is true if the manifold is compact or $\mathbb{R}^n$, but I don´t see it in general. This is the precise question:


Let $M$ be a connected manifold and $X$ a compact inside it, then is the union of $X$ and all the relatively compact components of $M\setminus X$ compact?


P.S. I already asked this [question](https://math.stackexchange.com/questions/4322564/is-the-union-of-a-compact-and-the-relatively-compact-components-of-its-complemen) in MSE a few days ago, but after asking a few people I thought it could be more appropiate for MO.



Is the union of a compact and the relatively compact components of its complementary in a manifold compact?
Actually, there is an elementary proof of this. I will imitate the one given in O.Forster Lectures on Riemann Surfaces. We assume $M$ is connected. Let $Y$ be equal to the union of $X$ with all the relatively compact components of $M \setminus X$


Let $U$ be a relatively compact, open subset containing $X$ and let $C\_j$, $j \in J$ be the connected components of $M \smallsetminus X$. Let $bU$ be the boundary of $U$, which is compact and disjoint from $X$.


* Claim 1. Every $C\_j$ meets $U$: If $C\_j \subset M \setminus U$, its closure in $M$ is also contained in $M \setminus U$, but $C\_j$ is a connected component of $M \setminus U$ so $C\_j = \overline{C\_j}$ which conttradicts connectedness of $M$.
* Claim 2. Only finitely many $C\_j$ intersects $bU$: This is because $bU$ is compact and the $C\_j$ are open and disjoint, anc cover $bU$.
* Claim 3. $Y$ is closed: Let $J\_0$ consist of the indices corresponding to relatively compact components. Then $M \setminus Y = \bigcup\_{j \not \in J\_0} C\_j$, which is open.


By Claim 2, we can find $j\_1, \ldots , j\_k \in J\_0$ be such that $C\_{j\_i}$ intersects $bU$. Then , by Claim 1 again, any other $C\_j$ is contained in $U$. Therefore,
$$ Y \subset U \cup C\_{j\_1} \cup \ldots \cup C\_{j\_k}$$
RHS is relatively compact by the choice of $U$ and the $j\_i$, and LHS is closed by Claim 3, so LHS is compact too.


