Remove messages from handler when thread quit