Let $E$ be a closed set in $\mathbb{R}$.
Then $E^c$ is open, hence it is a union of at most countable collection of disjoint segments, $\{I_i\}$.
Say, $I_i=(a_i,b_i)$.
Now, suppose $x\in E$ and $x$ is not an interior point of $E$.
How do i prove that $x$ is an endpoint for some $I_i$?