Dont include closing > in search for closing script

closes #2068