This error can be a real pain when having to restore backup files between different servers, or even your local machine. One way to be sure to fix this is to just bulldoze your way through the issue.
But – make sure you aren’t stepping on anyone else’s toes when doing this!
First, make sure you’re using [master] database, or you might be the connection that’s using the database.
Then find out which process is using the database.
Then ask the user nicely to log off. Or, just kill the connection outright
Now restore your database.