Effects of Three-Dimensional Electromagnetic Structures on Resistive-Wall-Mode Stability of Reversed Field Pinches