Stop the sale earlier when a pre-configured cap is hit. A hook can simply block swaps, adding the amounts raised on each swap and stopping at some point.