close stream after finishedHandler