[MERGE] fix close stream check out of order

Signed-off-by: David Goulet <dgoulet@efficios.com>