Does there exist a bijective mapping of an open interval with the corresponding closed interval having only finitely many points of discontinuity? Given $a<b$, is there a bijection $f \colon [a,b] \rightarrow (a,b)$ such that $f$ be continuous except at finitely many points only? 
I know that there does exist a bijection of $[a,b]$ with $(a,b)$. 
 A: It’s not possible.
Suppose that $f:[a,b]\to(a,b)$ is continuous except at finitely many points. Let the points of discontinuity in $(a,b)$ be $x_1<\ldots<x_{n-1}$. (Note that $f$ may also be discontinuous at one or both endpoints.) Let $x_0=a$ and $x_n=b$. Then $f$ is continuous on $I_k=(x_k,x_{k+1})$ for $k=0,\ldots,n-1$. The sets $f[I_k]$ for $k=0,\ldots,n-1$ must be pairwise disjoint open intervals in $(a,b)$, and their union must be $(a,b)\setminus\{f(x_k):k\le n\}$, i.e., all of $(a,b)$ except the $n+1$ points $f(x_0),\ldots,f(x_n)$. But if the $n$ intervals $f[I_k]$ cover all but finitely many points of $(a,b)$, the leftmost interval must have $a$ as its left endpoint, the rightmost interval must have $b$ as its right endpoint, and only the $n-1$ points between adjacent intervals can be uncovered. That isn’t enough to accommodate the $n+1$ points $f(x_0),\ldots,f(x_n)$.
A: Consider
$$f(x) = \begin{cases}
x+2\frac{b-a}3 &\text{if} & a\le x< a+ \frac{b-a}3 \\
x &\text{if} & a+ \frac{b-a}3\le x\le a+ 2\frac{b-a}3 \\
x-2\frac{b-a}3 &\text{if} & a+ 2\frac{b-a}3 < x\le b
\end{cases}$$
Then $f$ is a bijection on $[a,b] \to (a,b)$.
