Ahlfors says the following: if $f (z) $ is analytic on a disc, then its integral along any closed path contained in the disc is $0$. The proof for this is the following: Let $F (z)=\int_\sigma {f (z)dz}$ where $\sigma$ is a rectangular path that starts at a fixed point $z_0$ (they say in the middle of the disc), and ends at $z$. Rectangular path in the sense that if we have a path from $(x_0, y_0) to (x, y)$, then we move from $(x_0, y_0)\to (x, y_0)\to (x, y)$, or $(x_0, y_0)\to (x_0, y)\to (x, y)$. So anyway, we have $F (z)= \int {f (z)dx+if (z)dy}$. Moving along the first rectangular path and differentiating wrt y, we get $dF/dy=if (z)$. Similarly, moving along the second path, we get $dF (z)/dx =f (z)$. This shows that $F (z)$ is analytic. We also have the fact that $\int {f (z) dz} $ is an exact differential, and hence dependant only on its end points. This proves that the integral on any closed path will be $0$.
My question is that this proof works for any function $f (x, y)$ integrable on all rectangular paths, and in any open set (not just a disc). So what role does the analyticity of $f (z)$ and the shape of the disc have to play in this proof?