Fixes IoUtils#toFile not to include extra null characters at the end.