Fix database access in stocklines

We don't want to commit() anywhere other than in td.py - change to
flush() with optional rollback() on fail