Wrap the VM initialization process in a lambda

* So we can reuse that code later to initialize other VMs.
* As we are in main() it is safe to pass by reference, but
  we prefer to copy captured variable to avoid any possible
  side-effects between VMs.