This sutiation can be easily reproduced on your test environment. Open SSMS and connect to you server. Open New Query tab connected to MYTEST database (I assume that MYTEST is online). Don t do anything with this tab. Open new tab connected to the same database. Type the following code in your new tab
USE master
GO
ALTER DATABASE MYTEST
SET OFFLINE
Your code will be head blocked by the process you are running from your first tab.(Please see Activity Monitor). Why is the execution blocked even though there is no task accosiated with process in the first tab?