i agree, i didnt find the proof very natural when i first saw it. but i think the reason why openness is essential is because
we are trying to find a function f such that grad f = F. lets pretend we have the situation we have before in my above post. that is, f is to be defined on the set D that contains a boundary point c2.
suppose we have such an f such that grad f = F. specifically, df/dx at c2 equals the x component of F at c2.
but if you look at the picture, and imagine a function defined on D, you should see that df/dx is actually undefined. why? because df/dx means
'the change in f if we keep y constant and move along the x direction by a small amount' .
but there is no way to move along the x direction by a small amount because you'd step out of D. hence the derivative is undefined and if its undefined its obviously not equal to F.
it's like trying to find the derivative of a single isolated point. it doesn't make sense.
tldr, you are right, in practice, you would just restrict the domain to not include those boundary points, or to expand the domain to an open set (not always possible).