Properly close database session on /n/ API query. (Accidentially reverted this.)