Suppose that $A\subseteq\mathbb{R}$. Show that the following are equivalent:
(a) $A$ is closed.
(b) If $[a,b]$ is a closed interval for which $A\cap[a,b]$ is non-empty, then $\sup(A\cap[a,b])\in A$ and $\inf(A\cap[a,b])\in A$.
MY ATTEMPT
Let us prove the implication $(a)\Rightarrow(b)$ first.
Since $A\cap[a,b]$ is non-empty and bounded above by $b$, it admits a supremum.
Moroever, we do also have that $A\cap[a,b]\subseteq A$. Hence we conclude \begin{align*} \sup(A\cap[a,b])\in\overline{A\cap[a,b]}\subseteq\overline{A} = A \Rightarrow \sup(A\cap[a,b])\in A \end{align*}
This is because the supremum of a set is a closure point of it. Similar reasoning applies to the infimum.
However I do not know how to approach the converse implication.
Could someone tell me what I am missing?
Any contribution is appreciated.
Hint: Suppose $A$ is not closed. Then, there exists some converging (and WLOG monotonic) sequence $x_1,x_2,\dots\in A\subset \mathbb{R}$ such that $\lim_{n\to \infty}x_n=x\not\in A$. Take $[a,b]=[x-1,x]$ if the sequence is increasing, or $[a,b]=[x,x+1]$ if it is deceasing, and observe...
(comment if more detail is needed!)