Trim the next file name

This removes trailing null characters, meaning the `file_put_contents` in `extractAllTo` doesn't error from a path with a null character in it.