vm.kill() will try to get vm.startup_lock, so it can't be called while holding it already. Fix this by extracting vm._kill_locked(), which expect the lock to be already taken by the caller.