title: c# Image from file close connection
body: <p>I display an image using c# in a pictureBox. Then I want to change the image's name. I can't because I get that the image is being used by another process. </p>
  
  <p>I open the image this way</p>
  
  <pre><code> Image image1 = Image.FromFile("IMAGE LOCATION"); ;
          pictureBox1.Image = image1; 
  </code></pre>
  
  <p>Then try to change it's name this way and I get an IO exception saying " The process cannot access the file because it's being used by another process.</p>
  
  <pre><code>System.IO.File.Copy(@"OldName", @"NewName"); //copy changes name if paths are in the same folder
  </code></pre>
  
  <p>Isn't the object image1 holding the image? Why is the file still locked by the previous process? Any suggestions would be appreciated. Many thanks!</p>