Added more functionality to correctly shut down the different threads.
The GUI now uses the executor and profiles.