As the example in your post amply demonstrates, using two different subsets of the topological space $X = \mathbb R$, the "closure of $A$ in $X$" is not a topological property of $A$: it also depends on $X$.
What one can say in this situation is that the closure is a topological property of a space-and-a-subset. That is, given a space $X$ and a subset $A$, and given another space $B$ and a subset $Y$, if there exists a homeomorphism $h : X \to Y$ such that $h(A)=B$ then the closure of $A$ in $X$ is homeomorphic to the closure of $B$ in $Y$. So in that situation it would be true that the closure of $A$ in $X$ is compact if and only if the closure of $B$ in $Y$ is compact.
So for the example in your post, one can reach an interesting conclusion: there does not exist a homeomorphism $h : \mathbb R \to \mathbb R$ such that $h(0,1)=(0,\infty)$.