Altered closeStream to free stream buffer, added getStreamBuffer function