fix statement handle  open/close flag treatment