Backward compactness and periodicity of random attractors for stochastic wave equations with varying coefficients