public override void CloseActiveFile()
 {
     wavStream.Flush();
     wavStream.Close();
     fileStream.Flush();
     fileStream.Close();
 }
        private void rewindSaveBtn_Click(object sender, EventArgs e)
        {
            //Get usable buffer and read bytes
            byte[] buffer = new byte[rewind.GetUsableBytes()];
            rewind.ReadBuffer(buffer, 0);

            //Open a file prompt
            SaveFileDialog fd = new SaveFileDialog();

            fd.Title  = "Save Audio Buffer";
            fd.Filter = "Audio File (*.wav)|*.wav";
            DialogResult ar = fd.ShowDialog();

            //Save
            if (ar == DialogResult.OK)
            {
                using (FileStream fs = new FileStream(fd.FileName, FileMode.Create))
                    using (WavEncoder wav = new WavEncoder(fs, rewind))
                    {
                        wav.Write(buffer, 0, buffer.Length);
                        wav.Flush();
                    }
                rewind.ResetBuffer();
            }
        }