Implemented error and close methods for streaming protocol.
Some documentation and renaming.