Fix bug in connection manager

caused the mysql connection to never be closed