removed db close in the wrong place
fixed license agreement code return none