I did a similar thing in which the program was set to self destruct which proved problematic to say the least because if files were in use it refused to delete. I had to go through a huge work around to get it right and at the end of the day it still had problems with leftovers lingering behind.