Add the break as a separate routine which you skip if trials.thisN != 49 (where 49 is half your number of trials minus 1).
trials.thisN != 49