Write to file in custom action

Hello, I encountered a problem when I tried to open and write to a local .json file in a custom action. The .json file just stores a small dict and I want that in custom action, the modified user utterance may be added to the file under some conditions.

After running action.py, the new entry was successfully added to .json, however at this step, the webpage that hosted the chatbot refreshes with all previous conversation gone. (I am using GitHub - scalableminds/chatroom: React-based Chatroom Component for Rasa Stack and it uses REST channel).

And I also got concurrent.futures._base.CancelledError error from RASA when it tried to execute the following action after the one with the above problem.

Anyone has a clue what might the reason and how can I solve it? I just want to update the file in custom action. Thank you a lot!