Explain why this counter argument does not work. In a metric space, open sets are countable union of closed sets. So I want to show

In a metric space, open sets are countable union of closed sets.

I reduce the problem to

Open intervals are countable union of closed intervals.

So I take the easiest set. $(0,1) = \bigcup_{i = 1} (-1/i,1 - 1/i)$
But clearly $(-1/i,1 - 1/i)$ is open, but if we replace by $[-1/i,1 - 1/i]$, then it might be right, but it does not make sense to me since $1/i \to 0$, so we have boundary $\{0\}$ and $\{1\}$.
This is to answer Brian's question, I mean answer.

*

*So following your comment; Since $X- U$ is closed, this mean for each $x \in U$, there is a open set of $x$ separating $U$ it from $X-U$; $B(x) \cap (X-U) = \emptyset$. So this means the distance between $x$ and $y$ (for some $y$) can be made arbitrary large, so $d(x,y) > 1/n$. I am not sure if I am going too far


*(i) Well isn't this just $F_n = f^{-1}[1/n, \infty)$? It is closed (and open). I am skipping some lines, but $f$ is continuous because for $x,z \in U$, $f(x) - f(z) \leq d(x,z)$. But if following your suggestion, then $x \in X-F_n \iff \not\exists x \in U$ such that $\inf d(x,y) > 1/n$, so $d(x,y) > 1/n$ for every $x \in U$ and $y \in X-U$, so $x \in B_{1/n}(x) \subset X - U$ hence open.
(ii) This is the tricky part. I guess certainly $U \supset  \cup_{n } F_n$. And if $x \in U$, then for all $n$, we get $d(x,y) > 1/n \implies f(x) > 1/n$. Actually this is showing $U \subset \cap F_n$...and I don't know if it follows from set inclusion that $\cap F_n \subset \cup F_n$.
EDiT:  Not sure where you trying to do, bu closed sets contain convergent sequences, so $y_n$ must admit a limit in $X-U$, the fact that $d(x,y_n) < 1/n$ implies $x$ is such the limit for $y_n$ when $n$ is large, but this implies $x \not\in U$, contradiction?
 A: Let me deal first with the special case of $\Bbb R$ that you have in your reduction.
Clearly you need the left endpoints of your intervals to be $\frac1i$, not $-\frac1i$, whether the intervals are open or closed: you certainly want them to be subsets of $(0,1)$. In fact $(0,1)$ is the union of countably many closed intervals:
$$(0,1)=\bigcup_{k\ge 3}\left[\frac1k,1-\frac1k\right]\;.\tag{1}$$
Clearly $\left[\frac1k,1-\frac1k\right]\subseteq(0,1)$ for each $k\ge 3$, so 
$$(0,1)\supseteq\bigcup_{k\ge 1}\left[\frac1k,1-\frac1k\right]\;.$$
On the other hand, if $x\in(0,1)$, there is a positive integer $m\ge 3$ such that $\frac1m<x$, and there is a positive integer $n\ge 3$ such that $\frac1n<1-x$. If we now let $k=\max\{m,n\}$, then $\frac1k<x$ and $\frac1k<1-x$, so 
$$\frac1k<x<1-\frac1k\;,$$
and hence $x\in\left[\frac1k,1-\frac1k\right]$. Thus,
$$(0,1)\subseteq\bigcup_{k\ge 3}\left[\frac1k,1-\frac1k\right]\;,$$
and we’ve proved $(1)$.

However, even for the metric space $\Bbb R$ your reduction to the case of open intervals needs to be justified: it isn’t entirely trivial. You can do it by using the fact that $\Bbb R$ has a countable base consisting of the open intervals with rational endpoints. Once you show that each interval $(p,q)$ with $p$ and $q$ rational is a union of countably many closed intervals, then you can use the fact that every open set is the union of countably many such open intervals to get the desired result.
This proves the result for $\Bbb R$, but you need it for all metric spaces, and there are metric spaces that look nothing at all like $\Bbb R$. There is, however, a way to adapt the idea of approximating an open interval in $\Bbb R$ by bigger and bigger closed intervals that ‘squeeze out’ to cover the whole open interval.
HINT: Let $\langle X,d\rangle$ be a metric space and $U$ a non-empty open set in $X$. For $x\in U$ let
$$f(x)=\inf\{d(x,y):y\in X\setminus U\}\;.$$


*

*Show that $f(x)>0$ for each $x\in U$.


For $n\in\Bbb Z^+$ let
$$F_n=\left\{x\in U:f(x)\ge\frac1n\right\}\;.$$
(The set $F_n$ here is analogous to the interval $\left[\frac1n,1-\frac1n\right]$ in the argument above.)


*

*Show that each $F_n$ is a closed subset of $U$.  

*Show that $U=\bigcup_{n\in\Bbb Z^+}F_n$.


Added in response to the edited question: 


*

*The fact that $d(x,y)>0$ for each $y\in X\setminus U$ is not enough to ensure that $f(x)>0$: the infimum of a set of positive numbers can be $0$. (For instance, the infimum of the set $(0,1]$ is $0$.) You’ll have to use the fact that $X\setminus U$ is closed to show that $f(x)>0$ for each $x\in U$.

*Yes, $F_n=f^{-1}\left[\left[\frac1n,\to\right)\right]$. However, to conclude that it is closed, you must either show that $f$ is continuous, or show directly that $X\setminus F_n$ is open; the latter is probably a little easier. And it is by no means necessarily true that $F_n$ is also open. To show that $U=\bigcup_{n\in\Bbb Z^+}F_n$, suppose not; then there is some $x\in U\setminus\bigcup_{n\in\Bbb Z^+}F_n$. This means that $x\in U$, and $x\notin F_n$ for each $n\in\Bbb Z^+$. Show that for each $n\in\Bbb Z^+$ there is a $y_n\in X\setminus U$ such that $d(x,y_n)<\frac1n$. Use this and the fact that $X\setminus U$ is closed to get a contradiction.
