Made RepositoryItemStream.Close idempotent so that it can be closed mult...

...iple times but only doing the cleanup on the first time through.

Avoided double-releasing the file lock on invalid range requests. Now we only release it once.

Henrik