too many network connections

Hi. I need some help with this problem:

I have a program that copies files over a network connection like this:

copy the file from
\\machine\whatever.txt

to
\\anothermachine\whatever.txt

using the CopyFile function...

My program does this copy X amount of times, and after 4-7 loops, I get the errormessage: "No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept"

Is it possible to close a connection after each copy, so it will not be a problem?

Any input will be greatly appreciated!
[647 byte] By [nkb] at [2007-11-17 22:36:50]