add db.close() to fix a small bug