Stability of a reversed field pinch with resistive and distant boundaries