fix the problem trap_listener on close will call undefined method