[minor] Correct event emitting of end event.