There is a proof of the above statement that I can't fully get my head around. It goes something like this.
Let $Y$ be a subset of a metric space $X$. $Y$ is closed iff $Y^c$ (complement of $Y$) is open (for if $x$ is a limit point of $Y$, every neighbourhood of $x$ contains a point of $Y$ different from $x$, so that $x$ is not an interior point of $Y^c$. Since $Y^c$ is open, ie. it contains all its interior points, if follows that $x\in Y$. It follows that $Y$ is closed.
Now let $p\in X, p\notin Y$ and let $q\in Y$. Let $V_q$ and $W_q$ be $\epsilon$-neighbourhoods (ie. open balls around) of $p$ and $q$, respectively, of radius less than $\frac{1}{2}d(p,q)$ (remember we are in a metric space). Since $Y$ is compact, there are finitely many pointds $q_{1:n}$ in $Y$ such that $Y\subset W_{q_1}\cup W_{q_2}\cup\ldots\cup W_{q_n}=W$. Let $V=V_{q_1}\cap V_{q_2}\cap\ldots\cap V_{q_n}$ (intersection).
And here is where I am puzzled. Because if we say $V$ is nonempty then we could say $V$ is the neighbourhood of some new $p$ which does not intersect $W$. Hence $V\subset Y^c$, so that $p$ is an interior point of $Y^c$. Since $p$ was not fixed, it follows that $Y^c$ is open.
But: how can we be sure that $V$ is nonempty? Consider $X=\mathbb{R}$ and let $Y$ be the closed interval $[1,6]$. Let's say $q_1=2,p_1=0,q_2=5,p_2=7$. Let $B(x, r)$ denote an open ball centred at $x$ with radius $r$. Then we could have $W_{q_1}=B(2,1)=(1,3)$ (open interval $(1,3)$), $V_{q_1}=B(0,1)=(-1,1)$, $W_{q_2}=B(5,1)=(4,6)$ and $V_{q_2}=B(7,1)=(6,8)$. Off course we will need further $W$s to cover $Y$, but $V_{q_1}\cap V_{q_2}$ is already empty -> frustration! :) What am I missing?
Also, how would the proof fail if $Y=(1,6)$ (the open interval $(1,6)$)?
I've been thinking about it for a few days so any hints would be highly appreciated.