Since $f$ is a homeomorphism near any point of $U-X$, hence we need only to prove $f$ is open near every point $p$ of $X$. Because $X$ is discrete, we can choose a small open ball $B(p,r)$ around $p$ such that $B(p,r)\cap X=\{p\}$. Denote $q=f(p)$, so we need only to prove that $f(B(p,r))$ is a neighborhood of $q$.
Since $f$ is locally homeomorphism in $U-X$, $f^{-1}(q)-X$ must be a discrete set, hence $f^{-1}(q)$ is also discrete. Therefore, we can choose $r>0$ properly such that $q\notin f(\partial B(p,r))$.
By continuousness of $f$, we have $f(\partial B(p,r))$ compact, hence there exists $\delta>0$ such that $B(q,2\delta)\cap f(\partial B(p,r))=\emptyset$.
Denote $B_0(p,r)=B(p,r)-\{p\}$, $A_{\epsilon}=\overline{B(q,\delta)}-B(q,\epsilon)$, where $0<\epsilon<\delta$. Let's look at the set $C_\epsilon:=A_\epsilon\cap f(B(p,r)).$
On the one hand, $C_\epsilon=A_\epsilon\cap f(\overline{B(p,r)})$ is compact hence closed in $A_\epsilon$; on the otherhand $C_\epsilon=A_\epsilon\cap f(B_0(p,r))$ is open in $A_\epsilon$ (since $f(B_0(p,r))$ is open by $f$ locally homeomorphism).
Conclusion: $C_\epsilon$ is both open and closed in $A_\epsilon$.
Note that $A_\epsilon$ is connected if and only if $n>1$, so if $n>1$ we have $C_\epsilon=A_\epsilon$ or $\emptyset$. For sufficiently small $\epsilon$, we always have $C_\epsilon \neq \emptyset$, hence $C_\epsilon =A_\epsilon$ for every $\epsilon>0$ sufficiently small. That is to say, $A_{\epsilon}\subset f(B(p,r))$ for $\epsilon>0$ sufficiently small. Therefore, put $\epsilon\rightarrow 0$ we have $B(q,\delta)\subset f(B(p,r))$, hence finish the proof.