That’s a strange problem, but I think you might have some standing water somewhere down steam, just a guess, there's a hidden place were those gnats are laying their eggs. I hear bleach and dishwashing soap kills them. But to get rid of them forever you need to find their nesting place and get rid of it.