defined behaviours for windows when closing