Fixed broken filename handling in freopen().