Make sure a server is stopped before deleting it

The commits ensure a server is stopped before deleting it, as otherwise it will error out.