Run frappe.db.commit() as the last command. Frappe usually does this automatically but in the console you have to do it yourself.
frappe.db.commit()