Fixed upload_stream not waiting for temp file stream to close before posting data to cloudify
Fixed so if server responds with HTTP 500 and HTML instead of JSON that node.js does not throw Error while trying to parse response JSON
Improve error handling of invalid JSON responses from server