Added callbacks for onOpenBegin and onCloseBegin