asp.net error Cannot close stream until all bytes are written
<p>I have an web application that works fine when uploading pictures but when uploading larger videos to picasa, I sometimes get an error message. Is there a way I can know that the steam is not needed anymore so I can close it (using the keyword "using" or something) thanks for any advice.
Error</p>

<blockquote>
  <p>System.Net.WebException: The request was aborted: The request was
  canceled. ---> System.IO.IOException: Cannot close stream until all
  bytes are written.</p>
</blockquote>

<pre><code> PicasaEntry entry = service.Insert(postUri, videoEntry);//This is the line that does the call
                PhotoAccessor googlePhoto = new PhotoAccessor(entry);
                stream.Close();//Fails here
</code></pre>
