Correlation between electrochemical impedance measurements and corrosion rate of magnesium investigated by real-time hydrogen measurement and optical imaging