It's completely final in the US. It wouldn't be quite as final in Canada where proving an error in interpreting the law by the judge materially contributing to an acquittal could result in it being declared a mistrial. It's very constrained even in Canada though.
If the jury found him guilty and the judge declared it a mistrial, the prosecution could have appealed having it declared a mistrial. There's nothing else they can do now though. The judge waited to rule on the defense trying to get a mistrial since they're meant to avoid that.