Add tag attribute, clean up the close event handling.