This is another proof for 1,
Let $U = \{x | d(x,A) < d(x,B)\},V =
\{x|d(x, A) > d(x, B)\}$. Since $d(x, A), d(x, B)$ are continuous functions, U,V are open sets . And they are disjoint. Also if $x\in A$, then $d(x,A)=0$ and $d(x,B)>0$ by closedness of $B$ ,so $x\in U$. Hence, $A\subset U$. Similarly $B \subset V$.
For 2, consider $M=\mathbb{R}^2$, $A=\{(x,y)|y=0\}$, the x-axis, and $B$ be the graph of $y=\frac{1}{x}$, say $B=\{(x,y)|y=\frac{1}{x},x>0\}$. Their distance is $0$.
I think the point of part 2 is that in part 1, we can't cover $A$ by $U=\bigcup_{x\in A}B_{\frac{d(A,B)}{3}}(x)$, since $B_{\frac{d(A,B)}{3}}(x)$ may be empty.
Nobody knows if the set of all reciprocals of Mersenne primes is closed. Or take the set of all reciprocals of odd perfect numbers; it is conjectured that it's open, there is a weaker conjecture that it's closed, but nobody knows.
Best Answer
A set, in a metric space, is "open" if and only if it contains none of its boundary points. If I am correct in interpreting the "dashed" boundary on the second square as meaning that those points are not in the set, then that set is open.
A set, in a metric space, is "closed" if and only if it contains all of its boundary points. If I am correct in interpreting the "solid" boundary on the first and third sets as meaning that those points are in the set, then that set is closed.
Of course, if a set contains some but not all of its boundary points then it is neither open nor closed.
It is even possible for a set to be both open and closed if it has no boundary points. In $\mathbb{R}^2$, the only such sets are the empty set and $\mathbb{R}^2$ itself.