This is a more complicated proof which works also on $(0,\infty)$. Write $$ F(\lambda)=\int_0^\infty \frac{f(x)}{x+\lambda}\, dx=\int_0^\infty f(x)\, dx \int_0^\infty e^{-(x+\lambda)y}\, dy=\int_0^\infty e^{-\lambda y} dy \int_0^\infty f(x)e^{-xy}dx $$ so that $F$ is the Laplace transform of $\int_0^\infty f(x)e^{-xy}dx$. By assumption $F(n)=0$ and then $F=0$ since the integers are a uniqueness set for the Laplace transform. But then, by uniqueness again, $\int_0^\infty f(x)e^{-xy}dx=0$ for $y>0$ and, by the same argument, $f=0$.