Ion backflow in thick GEM-based detectors of single photons