As an exercise, I've been trying to derive the Biot-Savart law from the second set of Maxwell's equations for steady-state current

$$\begin{align}&\nabla\cdot\mathbf{B}=0&&\nabla\times\mathbf{B}=\mu_0\mathbf{J}\end{align}$$

I've been able to do this using the fact that an incompressible field has a vector potential $\mathbf{A}$, allowing me to rewrite the second equation as

$$\nabla^2\mathbf{A}=-\mu_0\mathbf{J}$$

which can be solved by components using the Green's function for the Laplacian, yielding

$$\mathbf{A}(\mathbf{x})=\frac{\mu_0}{4\pi}\int\frac{\mathbf{J}(\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|}\,d^{3}\mathbf{x}'$$

and since $\nabla\times\left(\psi\mathbf{J}\right)=\psi\nabla\times\mathbf{J}+\nabla\psi\times\mathbf{J}$,
$$\nabla\times\mathbf{A}=\mathbf{B}(\mathbf{x})=\frac{\mu_0}{4\pi}\int\frac{\mathbf{J}\times(\mathbf{x}-\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|^3}\,d^{3}\mathbf{x}'$$

as desired. However, if instead I take the curl of both sides of Ampere's Law, and use the identity $\nabla \times \left( \nabla \times \mathbf{B} \right) = \nabla(\nabla \cdot \mathbf{B}) - \nabla^{2}\mathbf{B}$ initially, I find that

$$\nabla(\nabla \cdot \mathbf{B}) - \nabla^{2}\mathbf{B}=0-\nabla^2\mathbf{B}=\mu_0\nabla\times\mathbf{J}$$

which I can again solve like Poisson's equation, yielding

$$\mathbf{B}(\mathbf{x})=-\frac{\mu_0}{4\pi}\int\frac{\nabla'\times\mathbf{J}(\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|}\,d\mathbf{x}'$$

which can be simplified using the identity $\psi(\nabla\times\mathbf{J})=-\nabla\psi\times\mathbf{J}+\nabla\times\left(\psi\mathbf{J}\right)$, giving

$$\mathbf{B}(\mathbf{x})=\frac{\mu_0}{4\pi}\int\frac{\mathbf{J}(\mathbf{x}')\times(\mathbf{x}-\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|^3}\,d\mathbf{x}'-\frac{\mu_0}{4\pi}\int\nabla'\times\left(\frac{\mathbf{J}(\mathbf{x}')}{|\mathbf{x}-\mathbf{x}'|}\right)\,d\mathbf{x}'$$

The first integral is precisely the Biot Savart law, but I have no idea how to make the second integral vanish. I've exhausted any obvious vector calculus identities, and Stokes theorem doesn't help much. I'm clearly missing an obvious mistake, but I haven't been able to locate it. This is similar to other questions that have been asked before, but I have a specific question about a step in the derivation which is not answered elsewhere.