A self-consistent picture of Jupiter's nightside magnetosphere