Uploading files to processinstance crashes database

We’re experimenting with Camunda and its features to store files within processinstances.
As an evaluation we wrote the c# code bewlow which is supposed to start processinstances and add ~40MB files to it. This works fine for a few times but after a while the database reliably crashes with the error message below and we can only recover by restarting the camunda engine entirely and/or sometimes clear the database to get it working again.

We observe the same behaviour on:
Camunda 7, cent OS 7 connectected to MS SQL Server as well as a
pristine download of the Win64 Camunda package + openjdk 13 with the standard h2 database and no changes to config whatsoever.

Is there any limit to file uploads that we are not aware of?
How can we prevent the engine from crashing in this case and instead decline the start of a process instance for example? Any flags we might need to set?

Thanks.

One or more errors occurred. (Cannot instantiate process definition ProcessSDAW:1:14293a00-3934-11ea-89aa-00155d28650f: ENGINE-03004 Exception while executing Database Operation ‘INSERT ByteArrayEntity[a613645a-3935-11ea-9efa-00155d28650f]’ with message ’

Error flushing statements. Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.insertByteArray (batch index #7) failed. 6 prior sub executor(s) completed successfully, but will be rolled back. Cause: org.h2.jdbc.JdbcBatchUpdateException: Die Datenbank ist bereits geschlossen

The database has been closed [90098-190]

Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.insertByteArray (batch index #7) failed. 6 prior sub executor(s) completed successfully, but will be rolled back. Cause: org.h2.jdbc.JdbcBatchUpdateException: Die Datenbank ist bereits geschlossen

The database has been closed [90098-190]'. Flush summary:
[
INSERT HistoricVariableInstanceEntity[a6136459-3935-11ea-9efa-00155d28650f]
INSERT HistoricVariableInstanceEntity[a613645b-3935-11ea-9efa-00155d28650f]
INSERT HistoricJobLogEventEntity[a639d823-3935-11ea-9efa-00155d28650f]
INSERT HistoricVariableUpdateEventEntity[a613645d-3935-11ea-9efa-00155d28650f]
INSERT HistoricVariableUpdateEventEntity[a613645f-3935-11ea-9efa-00155d28650f]
INSERT HistoricProcessInstanceEventEntity[a6136458-3935-11ea-9efa-00155d28650f]
INSERT HistoricActivityInstanceEventEntity[ExclusiveGateway_1w767ff:a6136461-3935-11ea-9efa-00155d28650f]
INSERT HistoricActivityInstanceEventEntity[StartEvent_1:a613645c-3935-11ea-9efa-00155d28650f]
INSERT ExecutionEntity[a6136458-3935-11ea-9efa-00155d28650f]
INSERT ByteArrayEntity[a613645a-3935-11ea-9efa-00155d28650f]
INSERT ByteArrayEntity[a613645e-3935-11ea-9efa-00155d28650f]
INSERT ByteArrayEntity[a6136460-3935-11ea-9efa-00155d28650f]
INSERT VariableInstanceEntity[a6136459-3935-11ea-9efa-00155d28650f]
INSERT VariableInstanceEntity[a613645b-3935-11ea-9efa-00155d28650f]
INSERT MessageEntity[a639d822-3935-11ea-9efa-00155d28650f]
])

        var client = CamundaClient.Create("http://iw-dev-03:8080/engine-rest");
        var processDef = client.ProcessDefinitions.ByKey("ProcessSDAW");
        for (int i = 0; i < 10000; i++)
        {
            var res = processDef.StartProcessInstance(new StartProcessInstance
            {
                Variables = new Dictionary<string, VariableValue>
                {
                    {
                        "FileType",
                        VariableValue.FromObject("FRE")
                    },
                    {
                        "File",
                        VariableValue.FromFile(Enumerable.Repeat((byte)64, 40000000).ToArray(), "file.txt", "text/plain")
                    }
                }
            });
            var a = res.Result;
        }