add open/close events

add open/close events