Enhanced concurrency of DBConnection

Made separate locks for the command queue and the database connection.