Isn't a homeomorphism between an open interval and $\mathbb{R}$ a contradiction? Let $X = (-\frac{\pi}{2},\frac{\pi}{2})$. Define $f: X \rightarrow \mathbb{R}$ given by $f(x) = \tan(x), \, \forall x \in X$. It can be shown that $f$ is a homeomorphism.
We have that $X$ is an open set. $\mathbb{R}$ is open and closed. By the homeomorphism, $X$ should be open, once $\mathbb{R}$ is open; but also closed since $\mathbb{R}$ is closed.
However, $X$ is not closed.
What am I missing here?
Thanks!

The thing you are missing is that a homeomorphism is a morphism of spaces and not sets of a space. When you are considering the interval as the origin of the homeomorphism, you are really comparing a topology on $\mathbb{R}$, and a topology on the interval (the relative topology on the interval). As the interval is the whole set of that topological space, it is, indeed, closed, even though it may not be closed as a subset of the reals
