Added pin number to emit close event.