I have a c# code where it seems its not releasing the file It gets locked or something the output please fix it without breaking anything ty.

public async Task ConvertVocals(string selectedVoicePath, string singingVoiceFile, int qualityValue)
{
    const string outputsDir = @"C:\AI\UVR5_UI\outputs";
    const string finalOutputPath = @"C:\output\folder\NewVoice.wav";

    // Clear output directory
    foreach (var file in Directory.GetFiles(outputsDir))
    {
        try
        {
            File.Delete(file);
        }
        catch (Exception ex)
        {
            MessageBox.Show($"Failed to delete file '{file}': {ex.Message}");
        }
    }

    using var client = new HttpClient { Timeout = Timeout.InfiniteTimeSpan };

    try
    {
        using var sourceStream = File.OpenRead(singingVoiceFile);
        using var referenceStream = File.OpenRead(selectedVoicePath);

        using var form = new MultipartFormDataContent
{
    {
        new StreamContent(sourceStream)
        {
            Headers = { ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "\"source_file\"", FileName = "\"source.wav\"" } }
        }, "source_file", "source.wav"
    },
    {
        new StreamContent(referenceStream)
        {
            Headers = { ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "\"reference_file\"", FileName = "\"reference.wav\"" } }
        }, "reference_file", "reference.wav"
    },
    { new StringContent(qualityValue.ToString()), "diffusion_steps" },
    { new StringContent("1.0"), "length_adjust" },
    { new StringContent("0.7"), "inference_cfg_rate" },
    { new StringContent("true"), "auto_f0_adjust" },
    { new StringContent("0"), "pitch_shift" }
};

        HttpResponseMessage response = await client.PostAsync("http://localhost:6576/convert", form);

        if (!response.IsSuccessStatusCode)
        {
            MessageBox.Show($"Server error: {response.StatusCode}");
            return;
        }

        var jsonString = await response.Content.ReadAsStringAsync();
        using var jsonDoc = JsonDocument.Parse(jsonString);
        var root = jsonDoc.RootElement;

        if (!root.TryGetProperty("windows_path", out var pathElem) && !root.TryGetProperty("file_path", out pathElem))
        {
            MessageBox.Show("Server response missing 'windows_path' or 'file_path'");
            return;
        }

        string serverFilePath = pathElem.GetString();
        if (string.IsNullOrWhiteSpace(serverFilePath) || !File.Exists(serverFilePath))
        {
            MessageBox.Show("Output file from server not found.");
            return;
        }

        // Delete old vocals first
        var oldFile = GetFirstVocalsWavFile(Path.GetDirectoryName(finalOutputPath));
        if (!string.IsNullOrEmpty(oldFile) && File.Exists(oldFile))
        {

        }

        // Copy new converted vocals
        File.Copy(serverFilePath, finalOutputPath, overwrite: true);

        MessageBox.Show($"Conversion succeeded. File saved to:\n{finalOutputPath}");
        Thread.Sleep(2000);
        CombineWavs();
    }
    catch (TaskCanceledException)
    {
        MessageBox.Show("Request was canceled. It may have taken too long.");
    }
    catch (System.Text.Json.JsonException jEx)
    {
        MessageBox.Show($"Failed to parse server response: {jEx.Message}");
    }
    catch (Exception ex)
    {
        MessageBox.Show($"Error during conversion: {ex.Message}");
    }
}