You need to ensure that the database can be dropped. That means nobody is currently using it.
If it's only your application you should close all connections (really close, be aware of connection pooling) and then do the restore. Or if there are also other connections you can i.e. forcibly close these connections by doing DELETE FROM MON$ATTACHMENTS WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION
.