Counterexample to " a closed ball in M is a closed subset." I am studying topology, on my own, using a text I found online. I am currently reviewing the “Metrics” section that reminds me of the real analysis course I took over 10 years ago.
The text ask me to “show” the following:

Suppose M is a metric space. Show that an open ball in M is an open subset, and a closed ball in M is a closed subset.

I have what I think is a counterexample to the second part. First, let me state the definitions as they are written in the book I am using:

For any $x \in M$ and $r>0$, the (open) ball of radius r around x is the set
$$ B_r(x)=\{y \in M: d(x,y)<r \}, $$
    
  and the closed ball of radius r around x is
  $$ \overline B_r(x)=\{y \in M: d(x,y) \leq r \}, $$
A subset $A \subseteq M $ is said to be an  open subset of M  if it contains an open ball around each of its points.
A subset $A \subseteq M $ is said to be an  closed subset of M  if M\A is open.

I believe the following is a counterexample to this:

Let $$M = [1,10].$$ Now $ \overline B_1(5)=\{y \in M: d(5,y) \leq 1 \} $ is a closed ball. More simply put, $ \overline B_1(5)=[4,6] $. Lets call the closed ball $A$.  $$ A=\overline B_1(5)=[4,6]$$
  Clearly, $A \subseteq M $, and $ M-A = [1,4)  \cup  (6,10] $. However $M-A$ is not open because $\{1\}$ and $\{10\}$ cannot have open balls around them without going beyond M.

Is there an error in the text, or an error in my thinking? 
 A: The space $M = [1,10]$ lives on its own and doesn't know anything about numbers such as $0$ and $11$.
By definition,
$$B_2(1) = \{y\in M \mid d(1,y)<2\} = [1,2)\subset M\backslash A\text{,}$$
hence $A$ is closed, indeed.
A: $$[1,2)=\{y\in M\mid d(1,y)<1\}$$ is an open ball in $M$ centered at $1$. 
$$(9,10]=\{y\in M\mid d(10,y)<1\}$$ is an open ball in $M$ centered at $10$. 
These sets are evidently subsets of $M-A$. 
The sets are not open in $\mathbb R$ but that is not requested.
Realize that e.g. that $[1,2)=(0,2)\cap M$ where $(0,2)$ is an open set in $\mathbb R$. 
That allows the conclusion that $[1,2)$ is open in $M$ with respect to the subtopology on $M$ inherited from $\mathbb R$.
A: Besides what everybody here has answered, note that $\bar B_r(x) = d(x,\cdot )^{-1} ([0,r])$ and since $[0,r]$ is closed in $\Bbb R$ and $d(x, \cdot )$ is continuous (this is to be proved), then $\bar B_r(x)$ is always closed.
A: Your intuition is good in that $[1,4)$ and $(6,10]$ are not open in $\mathbb R$. However, they are open in $M=[1,10]$ - that is, openness is a property relative to the metric space. In fact, consider the definition of an open ball of radius $3$ around $1$ in $M$:
$$B_3(1)=\{y\in M:|y-1|<3\}$$
the condition $y\in M$ means that $y$ must be in $[1,10]$ and the condition $|y-1|<3$ implies that $y$ cannot be $4$ or more - thus $B_3(1)=[1,4)$.
Essentially, when we're working in a subspace of a metric space, we can "chop off" open sets like this. That is, we have that $(-2,4)$ was an open ball, and when we're in the metric space on $[1,10]$ we take their intersection to get $[1,4)$ being open in the subspace. We do not have to worry about the exclusion of points which are not in the space.
A: 
Clearly, $A \subseteq M $, and $ M-A = [1,4)  \cup  (6,10] $. However $M-A$ is not open 

This is incorrect.  $M-A$ is clearly open as the union of two open balls, $[1,4)$ and $(6,10]$.  Note that $[1,4) = B_3(1)$ and $(6,10] = B_4(10)$.  If you don't believe me, write out the set builder expression for the balls (including the part that says $y\in M$, recalling that $M=[1,10]$).  
