Branch points of closed holomorphic map between Riemann surfaces (proof verification) Let $X,Y$ be Riemann surfaces and $f: X \to Y$ be a nonconstant holomorphic map.
It is well known that if $X$ is compact, or more generally if $f$ is a proper map, then the branch points of $f$ form a discrete subspace of $Y$. In trying to understand why this is true, I came up with a proof that seems to work even more generally when $f$ is just a closed map, but I don't find that result stated anywhere. So probably there might be something wrong with my proposed argument. The main difference between this case and $f$ being proper is that the fibers are guaranteed to be finite, but I don't see considering infinite fibers would break down the following proof.
Could you tell me whether this argument works or if it breaks down somewhere?
Proposed proof: Let $y_0 \in Y$ be a branch point of $f$ and $(V, \psi)$ some chart for $Y$ around $y_0$. For each $x_i \in f^{-1}(y_0)$, we can find a chart $(U_i, \varphi_i)$ for $X$ around $x_i$ such that the local representation of $f$ in these charts is $z \mapsto z^{m_i}$, where $m_i$ is the multiplicity of $f$ at $x_i$. Now, define $$V' := Y \setminus f\left(X \setminus \bigcup U_i\right).$$ The fact that $f$ is closed implies that $V' \subseteq Y$ is open. Since $\bigcup U_i$ contains all preimages of $y_0$, it follows that $y_0 \in V'$. Moreover, for all $x \in X$ we have that $f(x) \in V'$ implies $x \in \bigcup U_i$. Now note that if $x \in \bigcup U_i$ is a ramification point of $f$, it has to be one of the $x_i$, due to the form of the local representations in each $U_i$. It follows that $V'$ does not contain any branch points apart from $y_0$.
Since we can do this for any branch point, we conclude that they form a discrete subspace of $Y$.
 A: It is proven in "General Topology" by Bourbaki (Ch. I.10, Theorem 1; see also references given by M.C. in a comment below the answer) that a continuous map $f:X\to Y$ of two topological spaces is proper if and only if it is closed and all point-preimages (aka fibers) of $f$ are compact. (Note that Bourbaki is using a slightly nonstandard definition of proper maps. However, properness in Bourbaki sense implies usual properness, see Ch. I.10, Proposition 6 in the same book.)
Now, suppose that $f:X\to Y$ is a continuous closed map between locally compact 2nd countable Hausdorff spaces. We are looking for sufficient conditions for $f$ to have compact fibers. I will give two, the second is more general than the first.

*

*All fibers of $f$ are nowhere dense in $X$. For instance, if $X$ is a connected complex manifold and $Y$ is a complex manifold, then every nonconstant holomorphic map $f: X\to Y$ satisfies this property. If, additionally, $X$ is 1-dimensional, then point-preimages are even discrete.

Lemma 1. If $f:X\to Y$ is a continuous closed map between locally compact metrizable spaces with nowhere dense fibers then $f$ is proper.
Proof. Let $X^+=X\cup \{\infty\}$ denotes the
1-point compactification of $X$. Since $X$ is assumed to be locally compact, 2nd countable, the space $X^+$ is 2nd countable and Hausdorff as well (it is a nice exercise). One says that a sequence $(x_n)$ in $X$  "diverges to infinity" if it converges to $\infty$ in $X^+$
Local compactness of $X$ ensures that $X^+$ is Hausdorff. Maybe this property can be avoided, but I prefer to have uniqueness of limits.
Suppose now that $y\in Y$ is such that $F=f^{-1}(y)$ is noncompact. Then $F$ has nonempty intersection with every neighborhood of $\infty\in X^+$. By the 2nd countability of $X^+$, it follows that there exists a sequence $x_n\in F$ which  diverges to $\infty$. Since $F$ is nowhere dense and $X$ is 2nd countable (1st countable suffices), for each $n$ there is a sequence $z_{nk}\in F^c=X\setminus F$ converging to $x_n$. After passing to a suitable diagonal subsequence, we find a sequence $z_n\in F^c$ such that:
(a) $z_n$ diverges to infinity.
(b) $\lim_{n\to\infty} f(z_n)=y$.
Since $z_n\notin F$ for all $n$, we obtain a closed subset $Z=\{z_n: n\in {\mathbb N}\}\subset X$ such that $f(Z)$ is not closed (since $y\notin f(Z)$, but $y$ belongs to the closure of $f(Z)$). A contradiction. qed
Corollary 1. Suppose that $X, Y$ are complex manifolds, $X$ is connected, $f: X\to Y$ is nonconstant, holomorphic and closed. Then $f$ has compact fibers and is proper. In particular, the image under $f$ of any discrete closed subset of $X$ is discrete and closed in $Y$.
Corollary 2. Suppose that $X, Y$ are (connected) Riemann surfaces, $f: X\to Y$ is nonconstant, holomorphic and closed. Then $f$ has finite fibers and the set of critical values of $f$ is discrete.
Remark. Of course, proving it directly is easier than proving the more general results above and below.
Now, back to the general topology:


*For every $y\in Y$, the preimage $F=f^{-1}(y)$ has noncompact boundary whenever $F$ is noncompact. This condition, for instance, rules out constant maps of noncompact spaces $X$ to $Y$.

Lemma 2. Suppose that $f:X\to Y$ is a continuous closed map between locally compact metrizable spaces and for every $y\in Y$, the preimage $f^{-1}(y)$ has noncompact boundary. Then $f$ is proper.
The proof is similar to that of Lemma 1 and I omit it.
