A Proof of Residue Theorem on a Compact Riemann Surface Usually a proof of the Residue Theorem on a Compact Riemann Surface uses the crucial fact that Holomorphic forms are closed. I tried to write a proof and somehow I didn't use that fact anywhere. Can someone please check if my proof is ok? Also, if it is correct I don't exactly understand how I was able to avoid that.

The Residue Theorem: $X$ Compact Riemann Surface. $a_1,\dots, a_n $ are distnct points in $X$. Let $X'=X-\{a_1,\dots, a_n\}$. Then for every holomorphic $1$-form $\omega\in\Omega(X')$, one has $\sum_{k=1}^{n}Res_{a_k}(\omega)=0$
Proof. Choose coordinate neighborhoods $(U_k,z_k)$ of the $a_k$ such that $U_j\cap U_k\neq\emptyset$ if $j\neq k$. Also we may assume that $z_k(a_k) = 0$ and each $z_k(U_k)\subset\mathbb{C}$ is an open disk of radius $1$. For every $k = 1, ... , n$ choose a function $f_k$ with compact support Supp$(f_k)\subset U_k$ such that there exists an open neighborhood $U'_k\subset U_k$ of $a_k$ with  $f_k\big| U'_k = 1$ and $U'_k$s are balls of the form $U'_k=\{x\in U_k:|z_k(x)|<\epsilon\}$ (for small enough $\epsilon>0).$ 
Set $g := 1 - (f_1 + ... + f_n).$ Then $g\big|U'_k= 0.$ Thus $g\omega$ may be continued to the point $a_k$ by assigning it the value zero, and may thus be considered as an element of $\mathcal{E}^1 (X)$. So by Stokes' Theorem we have $\int\int_X d(g\omega)=0$. $\exists R\in (\epsilon,1) $ such that Supp$(f_k)\subset \{|z_k|<R\}$ and $f_k\big|\{|z_k|<\epsilon\}=1$. Define $\Delta_k:=\{x\in U'_k:|z_k(x)|< R\}$
$\therefore \int\int_X d(g\omega)=\int\int_{X-\cup_{i=1}^{n}\Delta_i}d(g\omega)=0$
$\Rightarrow -\int_{\cup_{i=1}^{n}\partial\Delta_i}g\omega=0$ (Using Stokes')
$\Rightarrow \sum_{i=1}^{n}\int_{\partial\Delta_i}g\omega=0$
$\Rightarrow \sum_{i=1}^{n}\int_{\partial\Delta_i}\omega=\sum_{i=1}^{n}\int_{\partial\Delta_i}(f_1+\dots+f_n)\omega=0$ (as $f_k$ vanish outside $\Delta_k)$ 
$\Rightarrow \sum_{k=1}^{n}$ Res$_{a_k}(\omega)=0$

 A: Let $X$ be a compact Riemann surface and $\omega$ a smooth one-form on $X-p_1,\ldots,p_N$, let $U$ be an open $\subset X$ such that : $U$ contains all the $p_n$, it is homeomorphic to a simply connected domain in $\Bbb{C}$ and $U\cup\partial U=X$.
From here see $\partial U$ not as a subset of $X$ but as a closed-loop in $X$.
Topologically $X$ is obtaining by gluing different pieces of $\partial U$ together, that is $\partial U = \bigcup_{j=1}^J \gamma_j$ and each $\gamma_j$ is glued with some $\gamma_{\sigma(j)}$.
The complex topology induces an orientation, and as curves in $X$,
$\gamma_{\sigma(j)}$ must be $\gamma_j$ traversed in opposite direction because otherwise the points "on the left side of $\gamma_j$" would appear twice in $U$.
Thus $\partial U$ is homologous to $0$
$$2\int_{\partial U} \omega=\sum_j \int_{\gamma_j}+\int_{\gamma_{\sigma(j)}} \omega=\sum_j 0=0$$
And hence if $\omega$ is a meromorphic one-form ($\omega=gdf$ for two meromorphic functions) then
$$2i\pi\sum Res_{p_n}(\omega) = \int_{\partial U} \omega=0$$
