Fix memory leak caused by undisposed memorystream.
Merge pull request #385 from mono/fixMemoryLeak

Fix memory leak caused by undisposed memorystream.