Radiative decays of the Y(3940), Z(3930), and the X(4160) as dynamically generated resonances