I think it's evolutionary... flies like to stay out of harms reach of predators on the ground... The walking variety probably instinctively climb. My batch did/ does the same thing - only mine didn't have a complete muslin covering, ithad air holes and they would accumulate around them specifically so try with more ventillation.
Also at what temp are you keeping them? and what species of fly? - is it the curly wing, the no-wing or the *have normal looking wings but (hopefully) can't use them* sort?
High temp usually encourages *normal* wing formation