Explicitly cast strings to bytes before writing test strings to files