protected override void Dispose( bool disposing )
        {
            this.fileMutex.WaitOne();
            try {
                // make sure it's all written out
                this.indexOutput.Flush();

                long originalLength = this.indexOutput.Length;
                this.indexOutput.Dispose();

                using ( Stream blobStream = new StreamInput( this.cacheDirectory.OpenInput( this.name ) ) ) {
                    this.cloudProvider.Upload( this.name, blobStream, new FileMetadata {
                        Exists = true,
                        LastModified = new DateTime( this.cacheDirectory.FileModified( this.name ) ),
                        Length = originalLength
                    } );
                    Debug.WriteLine( "PUT {1} bytes to {0} in cloud", this.name, blobStream.Length );
                }

            #if FULLDEBUG
                Debug.WriteLine( "CLOSED WRITESTREAM " + this.name );
            #endif
            } finally {
                this.fileMutex.ReleaseMutex();
            }
        }