I'm going to use integration by parts, integrating $e^{-\frac{x}{2}}$ and differentiating $x^2 +1$ but before trying to take the limit $a \rightarrow +\infty$:
$ F(a)=\int_0^a(x^2+1)e^{-x/2} \,dx = [-2\cdot e^{-x/2}\cdot (x^2+1)]_0^a +4\cdot \int_0^ax\cdot e^{-x/2} \,dx$
Same here:
$ F(a) = 2-2\cdot e^{-a/2}\cdot (a^2+1) +4\cdot ([-2\cdot x\cdot e^{-x/2}]_0^a +2\cdot \int_0^ae^{-x/2} \,dx ) $
$\implies F(a) = 2 -2\cdot e^{-a/2}\cdot (a^2+1) -8\cdot a\cdot e^{-a/2} +8\cdot \int_0^ae^{-x/2} \,dx $
$:x \rightarrow e^{-\frac{x}{2}} $ is integrable on $[0;+\infty[$ , $ x^n\cdot e^{-\frac{x}{2}} \rightarrow 0 $ , when $ x \rightarrow +\infty$ for any n , so F has a limit in $+ \infty$:
$F(a)-> F =2+8\cdot \int_0^{∞}e^{-x/2} \,dx = 2+ 16\cdot \int_0^{∞}e^{-x} \,dx = 18 $
You should avoid writing things like : $-2e^{-\infty/2}(\infty^2+4\cdot \infty+9)$, always study the limit first and put it instead of this. This is not the proper way to manipulate infinite limits, you may make mistakes you would have avoided and get criticized while you did not mean to write false things. I know some people don't like to read calculations made on infinite quantity.