Hi @Ameen Khan ,
Agree with others. Suggest you using T-SQL instead of SSMS UI. Please follow below steps to take database offline.
1.Using below T-SQL to take database offline.
ALTER DATABASE <dbname> SET OFFLINE WITH ROLLBACK IMMEDIATE
2.If it is not work, there is most likely a connection to the DB from somewhere.
To find connections, use sys.sysprocesses
USE master
SELECT * FROM sys.sysprocesses WHERE dbid = DB_ID('MyDB')
To force disconnections, use ROLLBACK IMMEDIATE
USE master
ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Or you can run the following command to find out who is keeping a lock on your database:
EXEC sp_who2
And use whatever SPID you find in the following command:
KILL <SPID>
Then set the database offline.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".