Close files before deleting.

The stream from File.OpenRead was not being disposed, causing a potential sharing violation when the temp folder was deleted at the end of the test.
Fix tests that do care about the package directory.