prevent default and close event customized