Fix bug in rename() that occures if new filename starts with the old filename

There is an error in emscripten's rename() function:
You cannot rename a file to a new filename that starts exactly like the old filename
(e.g. /tmp/myfile to /tmp/myfile_new)