Fix early closure of SQLite cursors in ligolw_sqlutils