Added support for system Wait().
Shutdown context on exit.