A closed ball in a metric space is a closed set 
Prove that a closed ball in a metric space is a closed set

My attempt: Suppose $D(x_0, r)$ is a closed ball. We show that $X \setminus D $ is open. In other words, we need to find an open ball contained in $X \setminus D$. 
Pick $$t \in X-D \implies d(t,x_0) > r \implies d(t,x_0) - r > 0 $$ Let $B(y, r_1)$ be an open ball, and pick $z \in B(y,r_1)$. Then, we must have $d(y,z) < r_1 $. We need to choose $r_1$ so that $d(z,x_0) > r$. Notice by the triangle inequality
$$ d(x_0,t) \leq d(x_0,z) + d(z,t) \implies d(z,x_0) \geq d(x_0,t) - d(z,t) > d(x_0,t) - r_1.$$
Notice, if we pick $r_1 = d(t,x_0)-r$ then we are done.
Is this correct?
 A: Your proof consists of some correct steps done in the wrong order, which makes it something other than a valid proof. It looks more like scratchwork done in preparation for a proof.  I  rewrite it below, with some of the more important additions in bold. I will also change $t$ to $y$ throughout; when you wrote "$y$" you probably meant the same thing as "$t$".

Suppose $D(x_0, r)$ is a closed ball. We show that $X\setminus D(x_0,r) $ is open. In other words, for every point $y\in X\setminus D(x_0,r)$ we need to find an open ball contained in $X \setminus D$ with center $y$.
Since $y \in X\setminus D(x_0,r)$, it follows that $d(y,x_0) > r$, so $d(y,x_0) - r > 0 $. Let $r_1 = d(y,x_0)-r$.
I claim that the open ball $B(y, r_1)$ is contained in $X\setminus D(x_0,r)$. To prove this, consider any $z \in B(y,r_1)$.  Notice by the triangle inequality
$$ d(x_0,y) \leq d(x_0,z) + d(z,y) \implies d(z,x_0) \geq d(x_0,y) - d(z,y) > d(x_0,y) - r_1 =r.$$
This shows $z\in X\setminus D(x_0,r)$, which completes the proof.
A: No I do not think this is correct. The idea seems correct, but the execution was poor. You should specify that $y\in X\backslash D$. I am also not sure how you justify your last inequality.  If $t$ is arbitrary in $X\backslash D$ we cannot conclude $d(z,t)<r_1$ and $-d(z,t)>-r_1.$ 
Here is how I would solve the problem:
Let $X$ be a metric space, $p\in X$, $r>0$. 
Let $A=\{q\in X :d(p,q)\leq r\}$.  Let $\{q_k\}\in A$ with $d(q_k,q)\rightarrow 0$. 
We want to show $q\in A$. 
By the triangle inequality we have  $$d(q,q_k)+d(q_k,p)\ge d(q,p)$$. $\Rightarrow$ $$d(q,q_k)+r\ge d(q,p)$$ (Since $\{q_k\}\subseteq A)$
Now take the limit as $k\rightarrow \infty$ of both sides and we have $$0+r\ge d(p,q)$$
$$\Rightarrow q\in A$$ $\Rightarrow A$ is closed $$QED$$
