Doubt in proof while showing that injective continous map sends open sets to open sets. I was trying to prove the following statement

If $U \subset \mathbb{R}^n $ and suppose $f : U \to \mathbb{R}^n$ be a continous map which is injective. Then $f(U)$ is open in $\mathbb{R}^n$.

I considered an closed $\epsilon$-ball around a point $u \in U$, that is $$D_n=\{x \in \mathbb{R}^n:||x-u|| \leq \epsilon \} \subset U$$. Then it is clear that boundary of $D_n$, say $B=\{x \in \mathbb{R}^n:||x-u|| = \epsilon \}$ is homeomorphic to $S^{n-1} \subset \mathbb{R}^n$.
What I cannot understand is the fact that  $f(B)$ too is isomorphic to $S^{n-1}$. Remember that $f$ is given to be injective and continous, but how does that help?
 A: There is a homeomorphism $\varphi:S^{n-1}\to B$, and a bijective continuous map $f:B\to f(B)$. So the composition $f\circ\varphi:S^{n-1}\to f(B)$ is continuous and bijective. Since $S^{n-1}$ is compact and $f(B)$ is Hausdorff it follows that this composition is a homeomorphism.
A: $B$ is compact (bounded + closed), $f(B)$ is therefore compact.
$f|_B$ is therefore continuous, injective and surjective. It's inverse is also continuous because of compacity. Hence it is the homeomorphism that I think you were looking for.
That said, I do not know how this fact can help but a sketch of a solution which uses the same line of reasoning can be found below:

Assuming $U$ is open, one can show that locally $f$ is a homeomorphism.
We can assume wlog that $0 \in U, f(0)\in f(U)$ and we only need to be looking at a small neighbourhood of $0$. As you mentioned, $\overline B(0, \varepsilon) \subset U$ for some small $\varepsilon$.
Hence $g=f|_{\overline B(0, \varepsilon)}: \overline B(0, \varepsilon) \to f(\overline B(0, \varepsilon))$ is continuous, surjective (by definition) and injective (as per the assumption). Because $\overline B(0, \varepsilon)$ is compact, $g^{-1}$ is also continuous and $g$ is therefore a homeomorphism.
Finally consider $h=g|_{B(0, \varepsilon)}\text{ } (=f|_{B(0, \varepsilon)})$. As $g$ is a homeomorphism, so is $h$ towards its image. Finally notice that any open set in $B(0, \varepsilon)$ is also open in $\mathbb{R^n}$.
