Conversion to "with" for sqlite3 connections

Added "with conn:" everywhere that used to involve opening the sqlite3 database, taking an action, and then closing the connection later.