Shutdown API.

For real this time with tests.