diff --git a/networkb/wfile_transfer_file.cpp b/networkb/wfile_transfer_file.cpp index efb55e374..63814163c 100644 --- a/networkb/wfile_transfer_file.cpp +++ b/networkb/wfile_transfer_file.cpp @@ -60,6 +60,11 @@ WFileTransferFile::~WFileTransferFile() {} int WFileTransferFile::file_size() const { return file_->length(); } bool WFileTransferFile::Delete() { + // Since this file may still be open, need to ensure + // that it is closed so File::Remove will work. + if (file_->IsOpen()) { + file_->Close(); + } if (!File::Remove(file_->full_pathname())) { return false; }