Added mainthread code execution facilities
Closes all displayed widget after quitting

Until now, the app could crash because of unclosed windows
Fixed some gui API features
Plugin manager is now shown correctly every time
Removed useless post cleaning code