Rivian beats Q2 estimates with $0.47 loss, revenue tops $1.66B