removed unneeded autocommit and add cursor closing
removed all unneeded autocomits