Minor refactoring of chunked_stream.js

Additionally, some extra commas are removed, which are reported by older jshint versions.