The argument is basically just fine, but the notation in that last line is a bit off: when you write $\bigcup_{n\in\mathbb{N}}$, you’re saying that you want to take the union of some sets indexed by natural numbers. What follows $\bigcup_{n\in\mathbb{N}}$ should be a typical one of these sets with index $n$. If you knew that every member of $\mathcal{B}$ was compact, for instance, you could write $X = \bigcup_{n\in\mathbb{N}}\operatorname{cl}B_n$. What you want here is simply $X = \bigcup \{\operatorname{cl}B:B \in \mathcal{B}\text{ and}\operatorname{cl}B\text{ is compact}\}$.
If fact, you never needed to index $\mathcal{B}$ in the first place. It’s perfectly fine to say this:
- Let $\mathcal{B}$ be a countable base. Since $X$ is locally compact, for each $x\in X$ there is an open nbhd $U_x$ of $x$ with compact closure, and since $\mathcal{B}$ is a base for $X$, there is some $B_x \in \mathcal{B}$ such that $x \in B_x \subseteq U_x$. Clearly each $B_x$ has compact closure, and $X = \bigcup\limits_{x\in X}\operatorname{cl}B_x$. There are only countably many distinct members of $\mathcal{B}$, so there are only countably many different sets $B_x$, and we have therefore expressed $X$ as the union of countably many compact subsets, as desired.
Or you could replace that last sentence with something like this:
- $\{B_x:x\in X\} \subseteq \{B \in \mathcal{B}:\operatorname{cl}B\text{ is compact}\} \subseteq \mathcal{B}$, so $\{B_x:x\in X\}$ is countable, and $X = \bigcup\limits_{x\in X}\operatorname{cl}B_x$ therefore expresses $X$ as a countable union of compact subsets.
There are many other perfectly good ways to do it; I’m just trying to give you some idea of what’s possible, since you’re working on the proof-writing as much as you are on the mathematics itself.