I am having trouble understanding why $D$ needs to be relatively compact (compact closure) in the following theorem:
Theorem Let $U$ be an open subset of $\mathbb{C}$, and let $u: \, U \to [-\infty, \infty)$ be a subharmonic function. Further, let $D$ be a relatively compact subdomain of $U$, and $h$ be a harmonic functions on $D$ such that \begin{eqnarray} \limsup_{z \to \zeta} (u-h)(z) \leq 0 \quad (\zeta \in \partial D),\end{eqnarray} then $u \leq h$ on $D$.
Proof. The function $u-h$ is subharmonic on $D$, so the result follow by the maximum principle.
This is the theorem being used:
Maximum Principle Let $u$ be subharmonic on a domain in $\mathbb{C}$. If $\limsup_{z \to \zeta}u(z) \leq 0$ for all $\zeta \in \partial D$, then $u \leq 0$ on $D$.
So the proof makes perfect sense, except for why it isn't enough for $D$ to just be a domain?
Thanks!
The compactness assumption on $D$ is natural because the maximum principle for harmonic functions can fail in unbounded domains. For example, let $U=\mathbb C,$ and $D=\{x+iy: y>0\}.$ Define $u\equiv 0,$ $h(x+iy)=-y.$ Then $\partial D = \mathbb R,$ and
$$\limsup_{z\to \zeta}\, (u(z)-h(z)) =0$$
for all $\zeta \in \mathbb R.$ But clearly $u-h\le 0$ fails in $D.$