I have had this problem twice, the first time they went when i harvested my first grow but then they came back, i found the solution accidently whilst drinking beer in my grow room, the pot whith my plant in is sat ontop of another pot which is upside down i accidently spilled beer into the rim of the lower pot about 4 days ago but did not realise, i noticed today the flys were gone, so on closer inspection seen they were all drowned in the beer, solved the problem !
I would recommend this to anyone with the same problem, put a small amount of beer in a saucer next to your grow and watch them commit suicide !