Add onClose event and documentation.