Shows the process cannot access file because it is being used by any process

I have many jobs configured to a jenkins server and some of the jobs shows this message “the process cannot access file because it is being used by any process” and shows UNSTABLE. Here the build/test is PASSED but still shows the above message.
I am using send commands over SSH to execute command. Not sure which file access is not getting completed. how to make sure the commands are executed and waits for the command to executed.

if you are using linux, you can use lsof to see what has that file open
For windows there are various methods - filesystems - Find out which process is locking a file or folder in Windows - Super User