I installed a command-line version of Ubuntu in VirtualBox. After doing so, shutting down the VM would leave the VM container running instead of closing it out as I assumed. I found that it’s because ACPI was not installed and, potentially, the VM config wasn’t set to ACPI.
First, ensure the VM is setup for ACPI:
VBoxManage modifyvm [nameofmachine] --acpi on
And then in the VM, install
acpid and when shutting down use the
sudo apt-get install acpid user@virtualmachine: sudo poweroff