Set offline database

ALTER DATABASE <dbasename> SET OFFLINE WITH
ROLLBACK IMMEDIATE
GO