Fix rename() sometimes failing if another process uses openFileForRead()