onafterclose is same as onclose? If so, use onclose.