Minecraft wiki entry for Command_Block, associated text: In Java Edition, click the "Done" button or ↵ Enter to save the command and leave the command block GUI.
In Bedrock Edition, close the GUI to save the command and changes.