Electromagnetic damper for rotating machines