handling properly the connection transaction using the with ... as con statement of the sqlite3 connection