Try prefixing your restore with:
<your restore statements>
At present, I suspect that you are opening a new query window on the DB you want to restore which will put an implicit
in front of the query.
If the DB is in use, it cannot be restored to.