Once you have returned both spirits to the church, a series of shocking things will happen that ends with Madeline taking over Rosa's body. And regardless of what Madeline says, there is something Joey can do about it.
What has Joey got to work with? Madeline's totem doesn't work here, and Joey's ghost breath does nothing to either Madeline or Rosa.
The only thing he's got is his tie. If you right-click on that tie, Joey tells you that it's the only part of him that Rosa can touch. That means he can use it to touch Rosa too -- remember how he used it on Rosa at the end of Blackwell Deception?
When you're out in front of the church (and after you've grilled Madeline on every possible subject), use the tie on the pair of them.