I figured it out by replacing keyCode with charCode and changing the event to keypress.
editor.on("keypress", function (cm, event) {
            if (!cm.state.completionActive && event.charCode != 13 && event.charCode != 123) {
                CodeMirror.commands.autocomplete(cm, null, {completeSingle: false});
            }
        });
solved What is the keycode for the open curly brace {