Unfortuantely python doesn't have any way to run code when app is closed through the "X", so flip doesn't get a chance to restore your display settings.