How to make Firebase Cloud Function wait for a stream to close before terminating I store an object to Cloud Storage like this: