I have come across this issue a number of times when an unknown process is using the database when I am trying to restore it.
I solved this by using the following query to find the process Id:
SELECT spid, loginame, login_time, program_name
Then to kill it, you would use:
Kill id — eg kill 52