Subject Shutdown database issue

I'm running firebird 2.5-super on Ubuntu 16.04.

I want to restore a database with nbackup and before I do that I shut down the particular database file and delete the file and after that restore.

Sometimes during shutdown I get the one of these exceptions:

GDS Exception. 335544835. Target shutdown mode is invalid for database "/home/firebird/store_fdb/2005/FOOD.FDB"

GDSException: I/O error during "open" operation for file "/home/firebird/store_fdb/2064/"
Error while trying to open file

Even though the shutdown fails I can still delete the file and recreate it with nbackup.

All is executed with Jaybird JDBC. This is how I shutdown:
maintenanceManager.shutdownDatabase(FBMaintenanceManager.SHUTDOWN_FORCE, 3);

Any idea why these exceptions?