stream: do not destroy until writing FIN
test: add test