Add CloseStream API & fix broken test case
Change-Id: I292eb9e465dafe90a4c87c6f6a6a922231ddab57