The problem is that you try to restore into an active database...
You should use WITH REPLACE to overcome the problem...
RESTORE DATABASE MyDB
FROM DISK = 'C:\MyDB.bak'
WITH REPLACE
Or, if you are using UI choose Options on the restore window and click on the first checkbox, with the text "Overwrite the existing database (WITH REPLACE)"...
If you need to close active connections on an active database use this before restore:
USE MASTER
ALTER DATABASE MyDB SET OFFLINE WITH ROLLBACK IMMEDIATE
And this after:
USE MASTER
ALTER DATABASE MyDB SET ONLINE WITH ROLLBACK IMMEDIATE