Closing the connection to SQL Server, whether that is a connection utilizing SSMS or some other application causes the rollback of any currently active transaction(s) created by that connection. This includes any implicit transactions, and operations such as
RESTORE DATABASE, etc. See this answer for more details about what can cause a transaction to be rolled back. Be aware that rollback may take an extended amount of time to complete, and will continue whether or not the application that caused the rollback is connected or not. Rollback will continue even if you restart SQL Server - in fact, restarting SQL Server will likely result in the database being marked as "in recovery" while rollback continues.
If SSMS is actually still running (perhaps the user interface is not visible, but the process is visible in Task Manager), the query might be still running, but I highly doubt that is the case.
Most likely you have some other connection holding a lock on some objects in the database in question, or a rollback is continuuing.
You can check the progress of transactions that are being rolled back by looking at system DMVs, such as:
FROM sys.dm_exec_requests der
INNER JOIN sys.dm_exec_sessions des ON der.session_id = des.session_id
WHERE der.command = 'ROLLBACK';