On the stability of extrasolar planetary systems and other closely orbiting pairs