Small improvement to IO::ToAbsolutePath() and IO::ToRelativePath().

These changes will now make sure the path is clean by removing the ".." segments.