It would depend on who made the uninstaller.

I'm thinking that the reason the error is occuring is because the uninstaller is still running when you are attempting to delete the folder.

As a test, make is two step process. Run your uninstaller, and then run the delete folder code from a button that you click after the uninstaller is done.

I'm almost willing to bet it will work.