Characterization of Closed Sets in Metric Spaces Using Distances Here's what I'm trying to prove:
Let $(X,d)$ be a metric space. A subset $F$ of $X$ is closed iff for all $x \in X$:
$$d(x,F) = 0 \implies x \in F$$

Proof Attempt:
Let $F$ be a closed set. Then, let $x \in X$ so that $d(x,F) = 0$. Define a sequence $\{a_n\}_{n=1}^{\infty}$ of points in $F$ so that:
$$\forall n \in \mathbb{N}: d(x,a_n) < \frac{1}{n}$$
Such a sequence exists because otherwise:
$$\exists n \in \mathbb{N}: d(x,a_n) \geq \frac{1}{n}$$
which implies that $d(x,F) > 0$. Then, we notice that:
$$\lim_{n \to \infty} d(x,a_n) = 0$$
$$\iff \lim_{n \to \infty} a_n = x$$
So, this sequence converges to $x$. Suppose that $x \notin F$. Then, $x \in X \setminus F$. Since $X \setminus F$ is open:
$$\exists \delta > 0: B(x,\delta) \subseteq X \setminus F$$
But that just means that there are elements of the sequence $\{a_n\}_{n=1}^{\infty}$ inside of the open ball $B(x,\delta)$ and, therefore, inside of $X \setminus F$ and this is impossible. Hence, $x \in F$.
Now, suppose that for all $x \in X$:
$$d(x,F) = 0 \implies x \in F$$
We will show that $X \setminus F$ is open. Let $p \in X \setminus F$. Suppose that:
$$\forall \delta >0: \lnot{(B(p,\delta) \subseteq X \setminus F)}$$
Define $\delta = \frac{1}{n}$, where $n \in \mathbb{N}$. Then, we can define a sequence of points $\{a_n\}_{n=1}^{\infty}$ for each $n \in \mathbb{N}$ such that all of the terms of the sequence belong to $F$ and:
$$\forall n \in \mathbb{N}: d(p,a_n) < \frac{1}{n}$$
This means that:
$$\lim_{n \to \infty} d(p,a_n) = 0$$
$$\implies d(p,F) = 0$$
But this implies that $p \in F$ and that is a contradiction. Hence:
$$\exists \delta > 0: B(p,\delta) \subseteq X \setminus F$$
Since $p$ was arbitrary, it follows that $X \setminus F$ is a neighbourhood of all of its points. That is, it is an open set. So, $F$ is closed. $\Box$
Does the proof above work? If it doesn't, then why? How can I fix it?
 A: Both arguments are correct, but they’re a bit clumsy, stated a bit more awkwardly than necessary. I might reduce the first direction to something like this:

Let $F$ be closed, and suppose that $x\in X$ is such that $d(x,F)=0$. Let $U$ be any open nbhd of $x$. Then there is an $\epsilon>0$ such that $B(x,\epsilon)\subseteq U$, and there is an $n\in\Bbb Z^+$ such that $\frac1n<\epsilon$. Since $d(x,F)<\frac1n$, there is some $y\in F$ such that $d(x,y)<\frac1n$. Clearly $$y\in B\left(x,\frac1n\right)\cap F\subseteq U\cap F\ne\varnothing\,,$$ and $U$ was an arbitrary open nbhd of $x$, so $x\in\operatorname{cl}F=F$.

If you prefer to work with sequences, it could go something like this:

Let $F$ be closed, and suppose that $x\in X$ is such that $d(x,F)=0$. Then for each $n\in\Bbb Z^+$ there is an $x_n\in F$ such that $d(x,x_n)<\frac1n$. Let $\epsilon>0$ be arbitrary. There is an $n_0\in\Bbb Z^+$ such that $\frac1{n_0}<\epsilon$, and clearly $d(x,x_n)<\frac1n\le\frac1{n_0}<\epsilon$ for each $n\ge n_0$, so the sequence $\langle x_n:n\in\Bbb Z^+\rangle$ converges to $F$, and $x$ is therefore a limit point of $F$. But $F$ is closed and therefore contains all of its limit points, so $x\in F$.

The proof in the other direction can be greatly reduced:

Now suppose that $x\in F$ whenever $d(x,F)=0$; we’ll show that $X\setminus F$ is open. Let $x\in X\setminus F$; by hypothesis $d(x,F)>0$. Let $r=d(x,F)$; if $y\in B(x,r)\cap F$, then $d(x,y)<r=d(x,F)$, which is impossible, so $B(x,r)\cap F=\varnothing$. Thus, $B(x,r)$ is an open nbhd of $x$ contained in $X\setminus F$, which is therefore open.

