I have two suggestions for you:
- Your communication program should know when the upload is finished, and you can have your communication program to inform this 'rename process or thread' to rename a file has the specified file name.
- You may not have control over your communication process, if it is purchased or for whatever reason, then you can monitor the size of the uploaded file for a certain amount of time, and only rename it after its size has been fixed/stable for a certain amount of time.