Advocate general for Scotland quits over internal market bill