It depends on the agreement. If the fee was to represent you in the matter through trial and there was no discussion of a discount if the case was dismissed or settled earlier, then you would most likely owe the fee--a court would interpret that agreement to be that you were paying for the representation no matter how long (or short) it was. If the agreement was that the fee would be related to the stage of work completed or the hours put in, you would pay the appropriate amount.