Error in restore database
The message seems pretty clear: you cannot be using the DB1 database when trying to restore it - instead, use the master database!

So in SQL Server Management Studio, first close all windows that are open and using that database! Then run this:

USE master
GO

RESTORE DATABASE [DB1] 
FROM DISK = N'D:\new.bak' 
WITH RESTRICTED_USER, FILE = 1, NOUNLOAD, REPLACE, STATS = 10;