onclose event added