added callback option for open/close events