Fixed segmentation fault when closing streams using the blocking interface.