Calling event_detect for Opening/Closing