The bill weighed on the bank’s profits, but is close to drawing a line under the mis-selling saga.