Why are open and simply connected required for $\frac{\delta P}{\delta y} = \frac{\delta Q}{\delta x}$ to imply a conservative field? A theorem concerning line integrals runs as follows:

I want to develop some intuition as to why this theorem depends on $D$ being open and simply-connected.
My thoughts:
$D$ being closed (that is, intuitively, if the region had a boundary) should have no bearing on whether $F$ is conservative. A conservative vector field could still exist on boundary points (I can still run around the boundary in two paths from an incident point to a final one and aggregate some equal quantity).
If $D$ were not simply connected by, say, containing a hole inside of it, the hole wouldn't be a part of $D$. This means that $\frac{\delta P}{\delta y} = \frac{\delta Q}{\delta x}$  being true still implies a conservative field at all other points (which, collectively form D). Hence, $F$  can still be considered conservative.
 A: Here's a somewhat informal idea of what's happening. The relevance of the quantity $\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}$ (this is the magnitude of the curl of $\mathbf{F}$), evaluated at a point $(x,y)$, is that the line integral around a very small closed curve $\gamma$ at $(x,y)$ is approximately $(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y})\cdot (\text{area inside $\gamma$)}$. In particular, if $\frac{\partial Q}{\partial x} = \frac{\partial P}{\partial y}$, then the line integral around small enough closed curves is more or less zero.
Now, $\mathbf{F}$ being conservative is equivalent to the line integral of $\mathbf{F}$ around every piecewise smooth closed curve being $0$. The problem therefore becomes: if you know the line integral around small enough closed curves is (essentially) zero, can you conclude the same for any closed curve? You could try to do this as follows. Say $\gamma$ is a closed curve; for simplicity, let's imagine it's the boundary of a square, oriented counterclockwise. Divide up the interior $R$ of the square into very small squares. Each small square $S_i$ has a boundary curve $\gamma_i$, oriented counterclockwise. Notice that every edge of a small square is matched with another edge of an adjacent square which is oriented in the opposite direction, except for the boundary edges that form $\gamma$. Thus, when we take the sum of the integrals $\int_{\gamma_i} \mathbf{F}$ over all the little curves $\gamma_i$, the contributions from interior edges cancel out and we're left with $\int_{\gamma} \mathbf{F}$.

On the other hand, the curves $\gamma_i$ were very small, so each term $\int_{\gamma_i} \mathbf{F}$ is approximately $(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y})\cdot (\text{area inside $\gamma_i$)}$. Adding these up gives, approximately, $\iint_R (\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y})\,dx\,dy$ (and if you take a limit as the curves $\gamma_i$ shrink, the word "approximately" goes away). So, $\int_{\gamma} \mathbf{F} = \iint_R (\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y})\,dx\,dy$—this is Green's theorem. In particular, if $\frac{\partial Q}{\partial x} = \frac{\partial P}{\partial y}$, the integral of $\mathbf{F}$ around $\gamma$ is $0$, which means $\mathbf{F}$ is conservative.
Now there's an immediate problem when the domain of $\mathbf{F}$ isn't simply connected: if $\gamma$ goes around a hole, then you can't fill in the region enclosed by it with little closed curves (at least not ones you can integrate $\mathbf{F}$ along).
(It's possible to turn this bug into a feature, i.e. to quantify the discrepancy between "$\mathbf{F}$ is conservative" and "$\frac{\partial Q}{\partial x} = \frac{\partial P}{\partial y}$" as a way of seeing what sort of holes your domain has. This is the idea of de Rham cohomology, which a couple of people have mentioned already.)
A: As commented by dafinguzman openness is required to have well defined partial derivatives. At a point of he boundary it might be tricky to define a partial derivative.
As for simply connected, consider the field
$$
(P,Q)=\Bigl(-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\Bigr),\quad (x,y)\ne(0,0).
$$
It satisfies
$$
\frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}
$$
but is not conservative. The line integral along a circle centered at $(0,0)$ is not equal to $0$.
