I believe
this[
^] may be the reason for the problem.
Also you need to dispose of the image after you are done with it;
img.Dispose();
One more thing why are you using a PictureBox? why not output directly to the form it would be faster and less prone to problems.