Portugal military chief resigns over remark on gay soldiers