TextFile: Fix a potential bug when reopening a file as text.

Copy the filename before reopening the file since not doing that can lead to an incorrect memory access because the filename is emptied during the process.

Backport of MPC-HC commit 2a75078
MPC-HC commit: a0e49fe24d028852d3a64f3a29fc2fe6ee63185f

Merge pull request #69 from Nevcairiel/utf8subsimprov

Improve handling of UTF-8 subtitles with BOM.

Never fallback to ASCII/ANSI in that case even if an invalid UTF-8 character is detected.