API: DB session fixes

* Set the max session count to 20 instead of 4
* Actually close sessions when we are done with them

Change-Id: I29c738654e4bef94d53dcd8db7abce4a4feacae6