title: Files not being released, even with .Dispose()
body: <p>I have a simple C# application for renaming and resizing images, and I have a little problem - when it completes working with all given files, the last one always stays in the memory, or whatever, of the program, and I can't delete it without closing the program.</p>
  
  <p>How can I make my code always release the files it works with after it has finished?</p>
  
  <p>here's what I have</p>
  
  <pre><code>     private void processFiles() {
          foreach (string oldFileNamePath in fileEntries) {
              ...
              File.Move(oldFileNamePath, newFileNamePath);
              if (isResizeImage) {
                  if (!extension.Equals(".gif")) {
                      Image newImage = Image.FromFile(newFileNamePath);
                      int newWidth = (int) (newImage.Width * (1 + ((double) percentageSize / 100)));
                      int newHeight = (int) (newImage.Height * (1 + ((double) percentageSize / 100)));
                      newImage = ResizeImage(newFileNamePath, newWidth, newHeight);
                      newImage.Save(directory + RESIZED_DIRECTORY + "\\" + newFileName, ImageFormat.Jpeg);
                      newImage.Dispose();
                  } else {
                      // only move
                      File.Move(newFileNamePath, directory + RESIZED_DIRECTORY + "\\" + newFileName);
                  }
              }
          }
      }
  
      public static Bitmap ResizeImage(String path, int width, int height) {
          Image image = Image.FromFile(path);
          var destRect = new Rectangle(0, 0, width, height);
          var destImage = new Bitmap(width, height);
          destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
          using (var graphics = Graphics.FromImage(destImage)) {
              // process image
              using (var wrapMode = new ImageAttributes()) {
                  wrapMode.SetWrapMode(WrapMode.TileFlipXY);
                  graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
              }
          }
          image.Dispose();
          return destImage;
      }
  }
  </code></pre>