XD-1975 Avoid IllegalStateException on stream stop