Changes so that settings work properly on Mac

On Mac, ```closeEvent``` is not called when the user quits the application before closing the window. For this reason, it needs to be manually connected to the ```close``` slot.

Also on Mac, the file open dialog box will not accept a path without file name as the root folder. To fix this, we are now writing the full path to the last opened file instead.