added indexes to tables and replaced tpogresqlclose by commit as in anfo...

...g_dm