Trim name after removing excess cruft.

When excess strings are removed from a thread’s name, sometimes there’s whitespace left after it. This messes up the thread names on the statistics page.