While trying to solve this integral $$ I=\int_{-a}^{a}dx\frac{e^{-i\omega x}e^{-x^2/4b^2}}{(x-i\epsilon)^2}Erf(a-|x|)~, $$ I found something that seems a contradiction. I am clearly missing something, but cannot figure out what.
Specifically, since $Erf(0)=0$ one can extend the integrand to the complex plane, evaluate the integral on the contour made by glueing the segment $[-a,a]$ to the half circle of radius $a$ (either in the upper plane), and use Cauchy's theorem to argue that the contour integral solves to $2\pi i$ times the residue in $x=i\epsilon$. Then, since on the half circle the function is identically zero, one gets $$ I=2\pi i~\lim_{z\to i\epsilon}\frac{d}{dz}\left(e^{-i\omega x}e^{-x^2/4b^2}Erf(a-|x|)\right)~, $$ which is some finite number. All is good up to now!
However, if one now takes the contour to be the full circle finds that zero (i.e. the result of integrating a function along a contour on which it evaluates to zero identically) is equal to $I$, i.e. a finite number.
Can anyone help me understand what I am doing wrong?