Fixed bug with saving on exit in Windows