Code clean, fix bug in closeEvent, initial implementation of preferences dialog, 'close' and 'close all' toolbar buttons