Fixed the db close and graphs.