Is there a reason why Harmonic functions are defined on open sets?
I'll be assuming the function is real valued (as it is in the problem) but some of what I say generalizes.
The domain of the function is presumed to be an open set because derivatives and the Laplacian are defined on open sets. The reason we need to use an open set as the domain for $f$ when talking about derivatives, is because the concept of a derivative doesn't make sense when considering a point in isolation: you need to look in the neighborhood of the point. If I told you that I have a function $f:\{0,1,2,3\}\to\mathbb{R}$ and wanted to know how do calculate $f'(x)$, you'd tell me I couldn't. The concept of the derivative of a discrete function makes no sense because the the concept of $$\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$$ doesn't make sense for such a function, since $f(x)$ is undefined for any value near $2$.
This is the core difficulty. Every closed set, $C$, in a metric space has the property that $\exists c\in C$ such that $\forall\varepsilon\exists x\in C^{c}$ such that $d(c,x)<\varepsilon$. This is immediate, because $C^c$ is open, so it doesn't contain its closure. Take $c$ to be some point in the closure of $C^c$ but not in $C$ and we are done.
In the particular case of the real numbers, although it's possible you'll have a one-sided limit you can calculate (say, in the example $[0,1]$), but the traditional definition of a derivative is the limit, not the one sided limit, and so you'll wind up with more differentiable functions than we normally have. Any time the left-handed limit doesn't exist, you will still get a derivative for $f(x)$ at $0$. For example, $f(x)=|x|$ is differentiable on $[0,1]$ under a one-sided limit.
Sometimes the above behavior is desirable, and so we wish to extend our notion of derivative to such places. There are two obvious ways to do this. For $f:A\to\mathbb{R}$ we can extend our definition of derivative to cover any point $x$ in the boundary of $A$ by considering the limit in the definition of a derivative to be a sequential limit, i.e. $$f'(x)=\lim_{n\to\infty}\frac{f(a_n)-f(a)}{a_n-x}$$ where $a_n$ is a sequence converging to $x$.
This definition can cause problems from being too general, as the derivative of a function on $\{0\}\cup\{\frac{1}{n}|n\in\mathbb{n}\}$ doesn't do what we are used to doing with derivatives, since there is no neighborhood or half neighborhood of any point on which $f$ is defined everywhere. The middle ground is to do as follows: Define the derivative of $f$ at a point, $a$ to be the number, $g(a)$, that satisfies $$f(a + h) = f(a) + g(a) h + O(|h|^2)$$ For all $h>0$. Define the function $f'(x)$ to be the formal derivative of $f(x)$ to be the function that satisfies $f'(a)=g(a)$ and which is defined exactly where the above equality holds.
This definition encapsulates the sense in which a derivative is the linear approximation of a function and so is very useful. It also always satisfies the mean value theorem, if you have an interval $f'(x)$ is defined in.