Fixed upload_stream not waiting for temp file stream to close before posting data to cloudify

Fixed upload_stream not waiting for temp file stream to close before posting data to cloudify