Ok. How 'bout this?

The variable that you store that next available drive letter in will be empty the first time through. The second time through, however, it will contain the letter that it selected the first time. So, check its contents. If it is not empty, then disconnect that drive right at that point and proceed with getting the next available drive letter. That way it will "appear" to your program that you are doing this for the first time.