The problem is due to other users using the database. To resolve the problem, you set the database to be used only by yourself. After the rename operation, you need to reset it back to be usable by other users. It is a common courtesy to inform all users prior to doing this operation.
ALTER DATABASE DBNAME SET SINGLE_USER WITH ROLLBACK IMMEDIATE
SP_RENAMEDB @dbname = 'old_name' ,
@newname = 'new_name'
ALTER DATABASE NEWDBNAME SET MULTI_USER -- set back to multi user