Set the window to hide before saving on exit so that it doesn't hang