$S,T\subset X$. $S$ is compact. $d(S,T):=inf\{d(s,t): s\in S, t\in T\}$.
My idea is to look at the set $A:=\{d(s,T), s\in S\}$, where by definition $d(s,T):=inf\{d(s,t),t\in T\}$
I know that $S$ is compacts means $S$ is closed and bounded in $X$. I also know that if $A$ is closed then we are done. So for the sake of contradiction I assumed that $A$ is open. Then for every $a\in A$, there is some $x\in S$ such that $d(x,T)=a$. I want to reach a contradiction so I want to prove that for every $x\in S$ there is some open ball $B(x,r)$ such that $B(x,r)\subset S$. However, I am stuck on the last step. any help?