As a remark, topological problem are better solved with vector, but in this case there is a raster-based solution.

use "expand" of one pixel to create a buffer around all your lines. Then you can do your region group and remove small parts (e.g. reclassify with threshold = 20, remember you have "buffers") for isolated groups. Finally, assuming that rivers are 1 and background is zero, you multiply the original with the cleaned buffer (or use a conditional). Alternatively, you can use "Thin" as a last step, which might slightly modify your lines but keeps the connectivity of nearby segments.