Fixed crash on stream close and restart.