code: public void delete() throws IOException {
          close();
          if (osFile != null) {
              boolean deleted = osFile.delete();
              while (!deleted) {
                  try {
                      Thread.sleep(100);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                      logger.error("{} not deleted.", osFile);
                  }
                  System.gc();
                  deleted = osFile.delete();
              }
          }
      }
docs: tries to delete the file
  
  @throws IOException