Castro resigning but will remain member of parliament