Non-existence of the potential function 
I am wondering why this theorem is not true when $(f,g)$ are defined on a more general open set $U$ which is not necessarily the entire plane or some disc. What is an example of a vector field
$$F(x,y)=(f(x,y),g(x,y))$$ defined on some open set $U$
satisfying the condition
$$\frac{\partial f}{\partial y} = \frac{\partial g}{\partial x}$$
but $F$ does not have a potential function?
 A: Consider $F = (\frac{-y}{x^2+y^2},\frac{x}{x^2+y^2})$ defined over the punctuated plane $U=\mathbb{R}^2\setminus\{(0,0)\}$. You can check that it satisfies the "closedness" condition, both $\frac{\partial f}{\partial y}$ and $\frac{\partial g}{\partial x}$ are equal to $\frac{y^2-x^2}{x^2+y^2}$. 
Written in polar coordinates we have
$$
F = (-\frac{\sin\theta}{\rho},\frac{\cos\theta}{\rho}).
$$
One might think that $F = \nabla \cdot \theta$ since $\theta = \arctan\frac{y}{x}$ and $\frac{\partial \theta}{\partial x} = \frac{-y}{x^2+y^2}$ and $\frac{\partial \theta}{\partial y} = \frac{x}{x^2+y^2}$, but this reasoning is not correct. The problem is that $\theta$ is not continuous over the whole of $U$. Depending on the definition somewhere will be a jump of $2\pi$. On the other side if we consider $U$ just the right half plane, then we can define $\theta$ to be continuous there (give values in $(-\pi,\pi)$), and $F$ will have a potential.
In general this $F$ doesn't have a potential function. If it had, any integral over a closed curve would give $0$, but ingetrating $F$ over a circle of radius 1 centered in zero gives $2\pi$. You can check this by using the polar coordinate representation.
In general, if a vector function satisfies the closedness condition, then locally in every point, i.e. given a point - in every small neighbourhood, F will have a potential function. What is not true that you can glue up all these potential functions to create a potential function defined over the whole set $U$. This depends on the topology of the set, and generally, if it is unpunctured then a potential exists.
See also Show that the form $w$ is closed but not exact
A: The vector field $(f(x,y),g(x,y))=\left(\frac{y}{x^2+y^2},\frac{-x}{x^2+y^2}\right)$ has
$$\frac{\partial f}{\partial y} = \frac{1}{x^2+y^2}-\frac{2y^2}{(x^2+y^2)^2}=\frac{x^2-y^2}{(x^2+y^2)^2}=\frac{2x^2}{(x^2+y^2)^2}-\frac{1}{x^2+y^2}=\frac{\partial g}{\partial x}$$
On an annulus $r<x^2+y^2<R$, this function fails to have a potential function; its integral around a circle centered at the origin (parametrized $(c\cos\theta,c\sin\theta)$ is
$$\int_{C}f\,dx+g\,dy = \int_{0}^{2\pi} \frac{c\sin\theta}{c^2}\cdot -c\sin\theta+\frac{-c\cos\theta}{c^2}\cdot c\cos\theta\,d\theta = \int_0^{2\pi}-1\,d\theta=-2\pi$$
But then, if there were a potential function, that integral would have to be zero - the starting and ending points are the same. We can tell that the potential function "should" be the angle $\theta$, but that can't be extended continuously to the whole annulus.
In order to avoid this and examples like it, we need to avoid regions with holes in them - this example depends on the origin being "inside" but not part of the domain. The condition of an open disc or the interior of the rectangle ensures this, as a subset of the broader collection of simply connected open sets.
