Extending isomorphism of punctured Riemann surfaces In Schlag's book on Riemann surfaces, we have Problem $4.15$, which is:

Let $M, N$ be compact Riemann surfaces and suppose $f: M\setminus\mathcal{S} \to N\setminus\mathcal{S}'$ is an isomorphism, where $\mathcal{S}$ and $\mathcal{S}'$ are finite sets. Show that $f$ extends to an isomorphism from $M\to N$.

This is also Exercise 8.2 in Forster's text. I think we can prove this as follows (but I am not totally sure about this either).

Let $a\in \mathcal{S}$ and pick a sequence $a_n \subset M \setminus
> \mathcal{S}$ such that $a_n \to a$. Then, by compactness of $N$, there
  is a subsequence $f(a_{n_k})$ converging to some $p \in N$.
Suppose $p \in f(M \setminus \mathcal{S})$, and let $K:= \{f(a_{n_k}),
> p\}$. Since $f$ is continuous, we have $f^{-1} (K)$ is closed, hence
  $f^{-1} (K)$ is compact (by compactness of $M$). And, since $f$ is
  injective, we have $f^{-1} (K) = \{a_{n_k}, f^{-1} (p)\}$. 
Let $U_k$ be a neighborhood of $a_{n_k}$ containing none of the other
  elements of sequence $a_n$. Then for any neighborhood $U$ of $f^{-1}(p)$
  , the cover $\{U_k, U\}$ has a finite subcover, so all but
  finitely many elements of $a_{n_k}$ are in $U$. Thus, $a_{n_k} \to f^{-1} (p)$
  , which implies $f^{-1} (p) = a$, contradiction.
So, $p \in \mathcal{S}'$. Now, by the lemma in this answer and
  discreteness of $\mathcal{S}'$, it follows that $f(a_n) \to p$.
  Further, if $b_n \to a$ is a different sequence, then discreteness
  again implies $f(b_n) \to p$. Thus, we can continuously extend $f$ to
  $M$, hence we can holomorphically extend.
Now, we have an injective holomorphic map $M \to N$ of compact Riemann
  surfaces. By the open mapping theorem, it has to be an isomorphism.

However: in an old problem set of Curt McMullen, a similar problem is given:

Let $X$ be a compact Riemann surface and $A \subset X$ a finite set. Show that any injective holomorphic map $f: X\setminus A \to Y$, where $Y$ is another compact Riemann surface, may be extended to an isomorphism $X\to Y$.

The difference here is that we have to show ourself that $Y \setminus f(X\setminus A)$ must be discrete. How can we do this?
 A: Various forms of this question were asked several times at MSE. Any solution, as far as I know, will use some nontrivial results in the theory of Riemann surfaces.  
Theorem 1. Let $M, N$ be compact connected Riemann surfaces, $X\subset M$ a 
finite subset. Then every biholomorphic embedding $f: M-X\to N$ will extend to a biholomorphic map $M\to N$.  
Proof. I assume that you are already familiar with the Riemann-Roch theorem (Forster's book covers it); actually, I will need only a weak for of the RRT. From that, you learn that given a point $z_0$ on $N$ there exists a  rational function $g: N\to {\mathbb C}\cup \{\infty\}$ which has a (high order) pole at $z_0$ and is holomorphic away from $z_0$. That's all what we will need. Now, pick a point $z_0\in f(M)$ and consider the holomorphic function 
$$
h=g\circ f: M - f^{-1}(z_0) \to {\mathbb C}. 
$$ 
It is clear that for each $x\in X$, for any sequence $x_k\to x$, $x_k\in M-X$, the image sequence $(f(x_k))$ does not accumulate at $z_0$ (since $f: M-X\to N$ is injective), hence, $g\circ f(x_k)$ is a bounded sequence in ${\mathbb C}$. Therefore, taking $D$ to be a small open disk in $M$ containing any $x\in X$ and not containing $f^{-1}(z_0)$, we conclude that the holomorphic function 
$h|D -\{x\}$ is bounded. Therefore, $h|D -\{x\}$ extends to a holomorphic function to the entire disk $D$. It follows that $f|D-\{x\}$ also extends to a (necessarily injective) holomorphic function $D\to N$. Injectivity of the extension is clear. Thus, $f: M-X\to N$ extends to a holomorphic function $F: M\to N$. Injectivity of $F$ follows from that of $f$. 
Surjectivity of $F$ follows from the fact that the image of $F$ is open (since $F$ is nonconstant and holomorphic) and closed (since $M$ is compact). qed
Addendum. Here is an alternative solution, which requires more tools. 
Theorem 2. Let $M$ be a compact Riemann surface, $X\subset M$ is a finite subset, $N$ is a Riemann surface and $f: M-X\to N$ is a biholomorphic embedding. Then $N$ admits a holomorphic compactification $N'$ (which is a compact Riemann surface containing $N$, $N=N'-Y$, where $Y$ is finite)  such that $f$ extends to a biholomorphic map $M\to N'$. 
Sketch of the proof. 
As in the above proof, take a small open disk $D\subset M$ containing $x\in X$ and no other points of $X$. I will show that (for a certain holomorphic compactification $L$ of $N$)  the restriction of $f$ to the punctured disk $D^*= D-\{x\}$ extends holomorphically to the disk $D$
$$
F: M\to N'. 
$$
 Note that $\pi_1(D^*)$ is infinite cyclic, let $p: L\to N- Y$ denote the covering map corresponding to the subgroup
$$
\Gamma:= f_*(\pi_1(D^*))< \pi_1(N-Y). 
$$ 
(At this stage, I expect you to know the basic algebraic topology: Fundamental groups and covering spaces.) I equip $L$ with the complex structure obtained by pull-back of the complex structure on $N-Y$ via $p$. Then $f|D^*$ lifts to a holomorphic map $\tilde{f}: D^*\to L$. Furthermore, the fundamental group of $L$ is cyclic, since $\Gamma$ is the image of the cyclic group $\pi_1(D^*)$. Hence, either $L$ is simply connected or $\pi_1(L)\cong {\mathbb Z}$. 
I now apply the Uniformization Theorem (which is harder than RRT theorem as far as I am concerned) to the surface $L$. The conclusion is that $L$ is biholomorphic to a domain $A$ in the complex plane. This domain can be assumed to be bounded and equals either the unit disk $\Delta$ or the  punctured unit disk $\Delta^*=\{z: 0<|z|<1\}$ or an annulus
$$
\{z: r^{-1}< |z|< r\}
$$
for some $r>1$.  I will therefore identify $L$ and $A$. The holomorphic map $\tilde{f}: D^*\to A\subset {\mathbb C}$ is again bounded and, hence, $\tilde{f}$ extends holomorphically to the disk $D$. Let $h: D\to \tilde{D}\subset L$ be the biholomorphic extension, where $\tilde{D}$ is an open disk in $L$. One then checks that the restriction $p|\tilde{D}$ is 1-1 and, hence, by composing with $p$ we obtain a biholomorphic embedding $F: D\to N'$ extending $f$. The rest of the argument is as above.    
