WIP: rewrote management server stop logic using more reliable methods.