Top Scottish law officer resigns over UK Brexit bill