Exercise 2.4.4 from M. Ram Murty's Problems in Analytic Number Theory asks us to show that for $\chi$ a nontrivial Dirichlet character $(\operatorname{mod} q)$, we have the estimate $$\sum_{n\leq x}\frac{f(n)}{\sqrt n}=2L(1,\chi)\sqrt{x}+O(1)$$ where $f(n):=\sum_{d\vert n}\chi(n)$. I'm having trouble getting the correct bound on the error term.
Using Abel's summation formula and Dirichlet's hyperbola method, I found that $$\sum_{n\leq x}\frac{f(n)}{\sqrt n}=\frac{A(x)}{\sqrt x}+\frac{1}{2}\int_1^x\frac{A(t)}{t^{\frac{3}{2}}}dt$$ where $$A(x)=xL(1,\chi)-x\sum_{n> y}\frac{\chi(n)}{n}+O(y)+O\left(\frac{x}{y}\right)\text{ for any }y>0$$ Per my reading course professor, the optimal choice of $y$ for minimizing the terms $O(y),O(x/y)$ would be $y=\sqrt x$, but this yields $$A(x)=xL(1,\chi)-x\sum_{n> \sqrt x}\frac{\chi(n)}{n}+O(x^{1/2})$$ and the $O(x^{1/2})$ term, when integrated in $\frac{1}{2}\int_1^x\frac{A(t)}{t^{3/2}}dt$, yields a $O(\log x)$ term and thus poses a problem for $\sum_{n\leq x}f(n)/\sqrt{n}$ since all the terms that are not $2L(1,\chi)\sqrt{x}$ should be bounded. What am I missing?