Close server connections when the worker processes are closed.

This prevents the system from running into open descriptor limits when running
the tests (where the workers are created and destroyed repeatedly).
Migrate the role validation to the new api settings approach.