Automatically find an open port for running Gusto server

Also ensure that server shuts down cleanly if there's an error running
CLI mode.