Error on pavlovia when saving data - unable to save data for a session that is not OPEN

Description of the problem:
After subjects complete the experiment they see an error that the data cannot be saved with the following error printed out in js

FATAL 09:40:43.389 GUI.dialog psychojs-2022.1.1.js:1257 | {"origin":"Logger.flush","context":"when flushing participant's logs for experiment: eldarlabccl/combinedpart4","error":{"origin":"ServerManager.uploadLog","context":"when uploading participant's log for experiment: eldarlabccl/combinedpart4","error":{"origin":"http://pavlovia.org/api/v2/experiments/eldarlabccl/combinedpart4/sessions/2c19983d-9d58-42b4-aada-157894e7b8fc/logs","context":"when saving logs from a previously opened session on the server","pathWithNamespace":"eldarlabccl/combinedpart4","sessionToken":"2c19983d-9d58-42b4-aada-157894e7b8fc","error":"unable to save data for a session that is not OPEN","errorCode":null,"httpStatusCode":403}}}

Not only that, but once subjects exit they are re-routed to start the experiment over!

any idea what could be causing this error?

I have this problem too, but not for every session. Did you find a solution?

Do you have any code in “End Experiment” tabs of code components?

In the last routine I have a code in End Experiment that manipulates the message that is shown:

psychoJS.window.close();
psychoJS.quit({message: ‘\n\nKlik op OK om het experiment af te sluiten.’, isCompleted: isCompleted});
Scheduler.Event.QUIT;

I’m working with PsychoPy 2021.2.3

Thanks for your help

I’d recommend that you remove that code from End Experiment. You could try it in End Routine of the final routine but personally I’d recommend editing the message via Experiment Settings/Online