Critical Toroidal Rotation Profile for Resistive Wall Modes and Control of Magnetic Islands in Tokamaks