Metric spaces, uniform convergence and rienmann integral. i'm running through my metric spaces lecture notes and i want to make sure that i've got the majority of this right (and given that maths stack exchange is a life saver i thought id ask).
First things first. i'm a little confused about the following theorem and then a remark after.

Theorem: Let $f_n: [a,b] \rightarrow \mathbb{R}, \text{ for } n = 1,2,...$ be a sequence of Riemann integrable functions which converge uniformly to $f$ on [a,b]. Then f is Riemann integrable, and $\int^{b}_{a}f_n(x)dx \rightarrow \int^{b}_{a}f(x)dx$

they give a proof of this then make the following remark.

let $f_n:[0,\infty)\rightarrow\mathbb{R} \text{ where } f_n = \frac{e^{-x/n}}{n}$. then ($f_n$) converges uniformly to the zero function on $[0, \infty)$. however, $\int_0^\infty f_n(x) dx = 1$

i must be missing something because this seems to contradict the previous Theorem. my initial thought was that i must have a misunderstanding of a Riemann integrals so i went back over my old notes and would like clarification to make sure i'm on track.
so! we define a partition P of $A = [a,b]$,as $ P= \{x_0,x_1,...,x_n\} \text{ where } x_0 = a \wedge x_n = b$ such that $\forall \alpha \in [a,b],\alpha$ can be located in some small inteval $(x_{i-1}, x_i)$.
then we define a step function $\psi:[a,b] \rightarrow\mathbb{R} \text{ if } \exists P=\{x_0, x_1,...,x_n\} ~\wedge~ \{c_1, c_2, ...,c_n\} \text{ such } \psi(x)=c_i ~\forall~ x\in (x_{i-1},x_i)$
so basically we break up a set into sections assign a constant for each inteval and our step function is the mapping which tells us the respective value of any given interval.
then we define the "integral" (i'm skipping the part where we show that it doesnt matter what partition we take, so long as its a valid partition) as
$$I(\psi,P) = \sum_{i=1}^{n}c_i(x_i-x_{i-1})$$
which we can think of as the addition of the areas of the intervals.
the next bit i admit i get mixxed up from time to time so please do correct me if i'm wrong.
we define $$\sup_{(x_{i-1},x_{i})}f=M_i$$
so this is the largest value f takes when we plug in all the values of $x \in (x_{i-1},x_{i})$ in the instance of a step function it should be the same value ($c_i$) but incases of not being a step function it would be as stated above (largest value of the subset of the image despite the preimage not necessarily being the largest element in $(x_{i-1},x_{i})$)
oh and we also define $$\inf_{(x_{i-1},x_{i})}f=m_i$$
which lets us define upper and lower partitions as 
$U(f,p) = \sum_{i=1}^{n}M_i(x_{i}-x_{i-1})$ and $L(f,p) = \sum_{i=1}^{n}m_i(x_{i}-x_{i-1})$ respectively.
this lets us define the upper and lower integral over [a,b] as
$\overline{\int^{b}_{a}} f = \inf\{U(f,p):p \in p[a,b]\}$ (where p[a,b] is the set of all partitions on [a,b] (ie the partition has to be a valid partition))
so that turns into 
$$\overline{\int^{b}_{a}} f = \inf\{\sum_{i=1}^{n}M_i(x_{i}-x_{i-1})\} = \inf\{\sum_{i=1}^{n}\sup_{(x_{i-1},x_{i})}f \cdot (x_{i}-x_{i-1})\}$$ 
which looks messy to me but i need to make sure i understand this right
so... this is the smallest sum, of the largest values that f takes from the interval of $(x_{i-1}-x_{i})$ multiplied by $(x_{i-1}-x_{i})$ and $\underline{\int^{b}_{a}} f$
finally
we define f to be riemann integrable over $[a,b]$ if 
$$\overline{\int^{b}_{a}} f = \underline{\int^{b}_{a}} f$$
now...i know this was quite the read and so i commend you for getting to the end, i apologise for the length but i've been known to make silly mistakes in my understanding (which often leads me to not grasping finer subtleties, for dyslexia is a cruel mistress).
am i right in my thinking?
thank you in advance.
 A: In the theorem the interval $[a,b]$ is compact, but not in the example since $[0,+\infty)$ is not compact.
A: Note that the underlying domain of your Theorem is a compact interval. On each fixed interval, the theorem applies and gives us that $\int_a^b f_n(x)dx\to0$ as $n\to\infty$, but, as the example shows, it fails on an unbounded domain.
Here is a more dramatic example. Consider $f_n(x)=1/n$ on $[0,\infty)$. Then $f_n$ converges uniformly to $f(x)=0$. On each interval, $f_n$ is Riemann-integrable and $\int_a^b f_n(x)dx=(b-a)/n\to0=\int_a^b f(x)dx$ - in agreement with your Theorem -  but $f_n$ is not Riemann-integrable on $[0,\infty)$, since $\int_0^\infty f_n(x)dx=\infty$.
You can imagine this as follos: If you divide $[0,\infty)$ into intervals $[n,n+1]$, then on each of these intervals your theorem applies and tells us that $\int_n^{n+1}f_k(x)dx\to0$ as $k\to\infty$. Then
$\int_0^\infty f_k(x)dx=\sum_{n=0}^\infty\int_n^{n+1}f_k(x)dx$. Here we are tempted to do something like
\begin{align*}
\lim_{k\to\infty}\int_0^\infty f_k(x)dx=\lim_{k\to\infty}\sum_{n=0}^\infty\int_n^{n+1}f_k(x)dx&\color{red}=\sum_{n=0}^\infty\lim_{k\to\infty}\int_n^{n+1}f_k(x)dx\\&\color{lime}=
\sum_{n=0}^\infty\int_n^{n+1}\lim_{k\to\infty}f_k(x)dx=0.
\end{align*}
The green equality sign is justified by your theorem, but the red is not.
