Added proper handling of Resize, Move and Maximise events 

This is a suggested way of dealing with the problem reported in issue 1363.

Rather than just writing the size and position to the settings file on close, this updates the settings file, when they change. It also deals with minimization and maximization appropriately.
This and the other similar redundant comments should be removed.