Repository: yt-dlp
Issue: "Retrying fragment" always fails because of "Locking file failed" while downloading a livestream with the --live-from-start option
Labels: bug,triage,core:downloader

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.04.08** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Description

When the cmd contains the `--live-from-start` option and the network error `Got server HTTP error: IncompleteRead` appears for a fragment, yt-dlp retries to download the fragment. But any retry attempt always fails because yt-dlp tries to write to a part file that it has locked itself. So it skips the part and logs this error message:

```
[download] Got server HTTP error: IncompleteRead(117437 bytes read). Retrying fragment 2774 (attempt 1 of 10) ...
ERROR: unable to open for writing: Locking file failed: 'The process cannot access the file because another process has locked a portion of the file.'
ERROR: unable to download video data: Locking file failed: 'The process cannot access the file because another process has locked a portion of the file.'
```

This happens approximately once every 20 minutes in a livestream.

**Additional info:**
When this error appears and the flag `--no-part` is added, the download of the video or audio stream stops. While the download for the audio or video stream continues. (This can happen to the video or the audio stream since those are downloaded separately.)

### Verbose log

```shell
I don't have the complete output anymore because the livestream has been made private and I only captured the part with the error message. But here are at least the cmd I've executed and the part of the output that logs the error messages.

Live.cmd file:
set /p YOUTUBE_PAGE_URL="Video url:"
yt-dlp --no-playlist --no-hls-use-mpegts --live-from-start --embed-sub --sub-lang en,"en.*","en-*" %YOUTUBE_PAGE_URL% -f bestvideo[ext=webm][height<=1440]+bestaudio/best --merge-output-format=mkv -o "live"

Output containing the error messages:
[youtube] wfRPwwDgv5Q: Downloading webpage
[youtube] wfRPwwDgv5Q: Downloading android player API JSON
[youtube] wfRPwwDgv5Q: Downloading MPD manifest
[youtube] wfRPwwDgv5Q: Downloading MPD manifest
[info] wfRPwwDgv5Q: Downloading 1 format(s): 308+140
[dashsegments] Total fragments: unknown (live)
[download] Destination: live.f308.mkv
[dashsegments] Total fragments: unknown (live)
[download] Destination: live.f140.mkv
[download] 3.90GiB at  1.18MiB/s (26:08) (frag 2773)
[download] Got server HTTP error: IncompleteRead(117437 bytes read). Retrying fragment 2774 (attempt 1 of 10) ...
ERROR: unable to open for writing: Locking file failed: 'The process cannot access the file because another process has locked a portion of the file.'
ERROR: unable to download video data: Locking file failed: 'The process cannot access the file because another process has locked a portion of the file.'
[download] 115.34MiB at 25.90KiB/s (28:54) (frag 2858)
```