pylib: fix database to properly renew connection

self.commit acts on the session while execute touches only the
connection so it shouldn't call any function which has to do with
the session.

self.close() is called already by the self.renewConnection so we
don't have to call it twice