In apostol's analysis, this theorem is given a different proof(i feel so), but i wonder if this works as well(which is in fact the technique used to prove this theorem for the Euclidean Space $\mathbb R^n$)
Theorem : Suppose $(M,d)$ is a metric space and $S \subset M$ is a compact set. Then $S$ must be closed.
Proof : Suppose for the sake of contradiction, $x$ is an accumulation point of $S$ which is not in $S$.
We construct a covering of $S$ as follows - define $r_k=\frac{|x-x_k|}{2}$ for all $x_k \in S$.
Then the balls $B_S(x_k,r_k)$ cover $S$, and thus by compactness, there is a $m$ such that $S\subseteq \bigcup_{k=1}^{m}B_S(x_k,r_k)$.
Choose $\text{min}\{r_k\}_{m\geq k\geq 1}=r_{\text{min}}$.
Fix a $x_k$ in $S$ and choose an element $y$ in the ball $B_M(x_k,r_{\min})$ (possibly different from $x_k$)
Thus, $d(x_k,x)\leq d(x_k,y)+d(y,x)$ so that $d(y,x) \geq 2r_{k}-d(x_k,y)>2r_{\min}-r_{\min}=r_{\min}$ so that the ball $B_S(x,r_{\min})$ does not contain $y$, and varying $x_k$ all over $S$, we find that this contradicts our assumption that $x$ is an accumulation point of $S$.
This proof is just a general thing of the proof which appears before for this theorem where $M=\mathbb R^n$ and the metric is our well known Euclidean norm.
I would like to know if this proof is valid (which i doubt as then Apostol would've included this) and if wrong where is the fault.
Thanks.
I would write the proof as follows: let $x$ be an accumulation point of $S$ which is not in $S$. For each $s \in S$ we define $r(s) = \frac{d(s,x)}{2} > 0$ (the absolute value only works in $\Bbb R$ and its subspaces, this works in any metric space). Then $$\{B(s, r(s)): s \in S\}$$ is an open cover of $S$ and so by compactness of $S$ has a finite subcover $$B(s_1, r(s_1)), \ldots B(s_n, r(s_n))$$ for some $n \in \Bbb N$.
(Your notation suggests that $S$ is countable as you use indices $s_k$ right away, while I only index the finitely one we use in the finite subcover. The cover we start with is as big as $S$ is, so possibly uncountable.)
Now let $$r_0 = \min\{r(s_i): i = 1, \ldots, n\}$$ which is the minimum of finitely many numbers that are $>0$ so $r_0 > 0$. Now as $x$ is a an accumulation point of $S$ we can find $y \in B(x,r_0)$ such that $y \in S$.
Let $s_i$ be one of the centres from the finite subcover such that $y \in B(s_i, r(s_i))$ (it exists as we have a (sub)cover of $S$):
$$d(x,s_i) \le d(x,y) + d(y, s_i) < r_0 + r(s_i) \le 2r(s_i) = d(s_i,x)$$
which is a contradiction (a real number cannot have $r < r$).