close db connection after exception