Fixed minor bugs with getStreamBuffer and closeStream