release db before returning from authenticate

This is my first pull request so please forgive any errors but it seems that the db is not being released when performing HTTP authentication.  This means that open references are left to a database on every authenticate() call.