Update onclose function.