datastreams: do not hang when closing the link

Change-Id: Ib38472849d7b56bf3013f65d84f1b4cfbd91b2d0