Fixed race condition in m3u8 file rewriting