Difficulties in stating mean value theorem for functions which are not continuous on a closed interval.

If you just consider continuity of $f(x)$ on $(a, b)$, then the limits at endpoints could be infinity or do not exist at all.

For example $f(x)= \tan (x)$ on $(-\pi /2, \pi /2)$.

In that case the statement of the theorem does not make sense as it stands.


Because in the particular cases you evoke, it is always possible to bring you back to that form of the theorem.

For example if $f$ has only a left limit in $a$, you would define the function $g$ as $$ g(x) := f(x)\quad \text{if} \quad x>a $$ and $$ g(a) := \lim_{x\rightarrow a^+}f(x) $$ Then you can apply the theorem to $g$.

But it will much more complicated to state all the particular cases in the hypothesis, with no real gain, since they can be easily deduced with simple procedures as above.