Fix #35 typo and #30 add onOpen and onClose callbacks.