A proof about uniformly continuous function on an open interval and its extension I try to prove:

If $g$ is a continuous function on $(a,b)$ then $g$ is uniformly continuous on $(a,b)$ if and only if it is possible to define values $g(a)$ and $g(b)$ at the endpoints so that the extended function $g$ is continuous on $[a,b]$. 

Please can you check my proof?
If there are $g(a)$ and $g(b)$ such that $g:[a,b]\to \mathbb R$ is continuous then because $g:[a,b]\to \mathbb R$ is uniformly continuous, so is $g:(a,b)\to \mathbb R$. 
Let $g$ be uniformly continuous on $(a,b)$ and let $x_n \to a$ and $y_n \to b$. Because $x_n$ and $y_n$ are Cauchy and $g$ is uniformly continuous, $g(x_n)$ and $g(y_n)$ are Cauchy. Define $g(a) = \lim g(x_n)$ and $g(b) = \lim g(y_n)$. Now  this extended function $g$ is continuous at $a$ and $b$. It is enough to show it for one of the two points because the proof is similar. Let $\varepsilon >0$. The goal is to find $\delta$ such that $|x-a|<\delta$ implies that $|g(x) -g(a)|<\varepsilon$. By definition, $g(x_n) \to g(a)$ hence there is $N$ such that for $n>N$ it holds that $|g(x_n) - g(a)| < \varepsilon$. Now let $\delta = |a-x_{N+1}|$. 

I now know why my proof is false, thanks to the answer but I can't understand one part of the answer. The bounty is for extension of answer not for more answers.
 A: The second half of the proof is not correct, as the $\delta>0$, does not necessarily work for all $x$, $|x-a|<\delta$, but only for the terms of the sequence you chose.
Updated version. First define $g(a)=\lim_{n\to\infty} g(x_n)$, as you have done. Let $\varepsilon>0$, then there is a $\delta>0$, due to uniform continuity, such that
$$
|x-y|<\delta\quad\Longrightarrow\quad |g(x)-g(y)|<\varepsilon/2.\tag{1}
$$
In particular, let $$|x-a|<\delta/2, \tag{2}$$ and $n_0$, such that $n\ge n_0$, implies $|x_n-a|<\delta/2$. Then  every $x$ satisfying $(2)$, also satisfies
$$
|x-x_n|\le |x-a|+|x_n-a|<\delta,\quad \text{for every}\,\,n\ge n_0.
$$
Hence, due to $(1)$, if $x$ satisfies $(2)$ and $n\ge n_0$, then 
$$
|g(x)-g(x_n)|<\varepsilon/2,
$$
or equivalently
$$
g(x)-\varepsilon/2<g(x_n)<g(x)+\varepsilon/2, \quad \text{for every $\,\,n\ge n_0\,\,$
and $\,\,|x-a|<\delta/2$,}
$$
and taking the limits, as $n\to \infty$, we obtain 
$$
g(x)-\varepsilon/2\le g(a) \le g(x)+\varepsilon/2, \quad \text{for every 
$\,\,|x-a|<\delta/2$,}
$$
or
$$
|g(x)-g(a)|\le\varepsilon/2<\varepsilon \quad \text{for every 
$\,\,|x-a|<\delta/2$.}
$$ 
Thus, for every $\varepsilon>0$, there exists a $\delta>0$ such that
$$
|x-a|<\delta/2\quad\Longrightarrow\quad|g(x)-g(a)|<\varepsilon.
$$
A: To show the extended function $g$ is continuous at $a$ let $\varepsilon > 0$. 
Note that $|x-x_n|\le |x-a| + |a-x_n|$. Let $\delta$ be such that $|x-y|<\delta \implies |g(x)-g(y)|<{\varepsilon \over 2}$. 
Let $N$ be such that $n>N$ implies that $|a-x_n|<{\delta \over 2}$ and let $N'$ be such that $n>N'$ implies $|g(x_n)-g(a)|<{\varepsilon \over 2}$. 
Now if $|x-a|<{\delta \over 2}$ and $n>\max(N,N')$ then $|x-x_n|\le |x-a| + |a-x_n|<\delta$ and hence
$$ |g(x)-g(a)| \le |g(x)-g(x_n)| + |g(x_n) - g(a)| < \varepsilon$$
A: In your proof the definition of $g(a)$ or $g(b)$ is ambiguous. You fix a 
Cauchy sequence and define the limit as $g(a)$, but if you take another Cauchy 
sequence the definition might change. Say for example you take the function $\sin(1/x)$ on the interval $(0,1)$. Take the Cauchy sequence $1/\pi n$ . Then 
$g(0)$ would be zero, and if you take the Cauchy sequence $\dfrac{1}{2\pi n+\pi/2}$ your 
$g(0)$ would be $1$. Well function in the example I gave is not uniformly continuous. 
So to extend your proof $x_n\rightarrow a$ and $y_n\rightarrow a$ , because of 
uniform continuity $f(x_n)$ and $f(y_n)$ and converge same point given $\epsilon$
$|f(x_n)-f(y_n)|<\varepsilon$ there exist $\delta$ depending only $\varepsilon$.
