Some functions that open connectings with psycopg2 are not closing the connections after the function completes its work.