As part of a routine I'm doing, I'm making a copy of a db if the user does a simple save (for backup purposes). I use sourceFile.copyTo( destination, true ); and that works fine. However, after that I'm trying to do sourceFile.moveToTrash (or delete, either one) and keep getting a 3013 error, indicating that the file is in use, I assume. Before trying to delete the file, I've closed all connections to the db and I have no Filestreams open anywhere. I've tried doing a deleteAsync() and that doesn't do the trick either.
Any suggestions on avoiding the 3013 error when I go to delete the existing file? I've tried calling sourceFile.cancel() but that does nothing.
Finally got it by not just closing the connection but setting it to null, deleting the file, then creating a new connection.