Fridge Logic: Sure, it's a happy ending, since Joanna had a change of heart, and lets Billy stay with his dad. But then you realize there's no reason to think that she won't change her mind next week and decide she wants Billy back, and there's nothing stopping her from doing so.
Aside from her repeatedly establishing herself as fickle and unreliable, hardly the type to be entrusted with the care of a child.
She was still the child's mother, which would have gone a long way towards securing her custody, had she sought it again. The notion that the mother is automatically the best choice to raise a child, has only really been called into question in the last few years.