This Question gives the following argument for why the retract of a Hausdorff space is closed:
Proof. Let $x∉A$ and $a=r(x)∈A$. Since $X$ is Hausdorff, $x$ and $a$ have disjoint neighborhoods $U$ and $V$, respectively. Then $r^{−1}(V∩A)∩U$ is a neighborhood of $x$ disjoint from $A$. (*) Hence, $A$ is closed.
It looks to me like this presumes that every $x∉(X-A)$ has an neighborhood, $U$, that doesn't intersect $A$. Otherwise $r^{−1}(V∩A)∩U$ could be in $A$, and the proof wouldn't work. It seems to me though that the only way every $U$ could not intersect $A$ is if we've already assumed that $A$ is closed because otherwise there would be a point in the boundary of $A$, but not in $A$, and every neighborhood of this point would intersect $A$. And so we wouldn't be able to find a neighborhood, $U$, of this point that doesn't intersect $A$.
So does this proof actually work and I've missed something?