Fix select_db errors thrown as the db isn't closed or reset.

git-svn-id: https://svn.code.sf.net/p/freeghost/code/trunk@2632 71f96598-fa45-0410-b640-bcd6f8691b32
Fix issue in master->node replication again.

git-svn-id: https://svn.code.sf.net/p/freeghost/code/trunk@2633 71f96598-fa45-0410-b640-bcd6f8691b32
Merge svn with dev-branch
Merge master with svn
Merge master with dev-branch