The restore process consists of several phases. The first phase is called safety check. If we are attempting to restore a database with the same name but different files, the restore process is terminated. When the database does not exist on the instance of SQL Server but some file on disk is in name conflict with some filename that is going to be restored, the restore process is terminated as well.
The second phase tries to remove the rest of the corrupted database. After this phase, the database is recreated and recovered from backup.