update onPreClose option functionality