onclose modified