Add shutdown processing to command executor

This commit shuts down the application when the 'close' button
is clicked in the gui window.
Add more convenient constructor for cycle commands