Close cursor in db utilities