A subspace $A \subset X$ is called a retract of $X$ if there is a map $r: X \rightarrow A$ such that $r(a) = a$ for all $a \in A$. (Such a map is called a retraction.)
Proof. Let $x \notin A$ and $a =r(x) \in A$. Since $X$ is Hausdorff, $x$ and $a$ have disjoint neighborhoods $U$ and $V$, respectively. Then $r^{−1}(V \cap A) \cap U$ is a neighborhood of $x$ disjoint from $A$. (*) Hence, $A$ is closed.
I do not understand how "$r^{−1}(V \cap A) \cap U$ is a neighborhood of $x$ disjoint from $A$" implies that $A$ is closed. I would be grateful if someone could point me in te right direction.