close cursors after json encode; fixed basesql batch retries