keyboard: Change order of call in close to avoid shutdown hang, as suggested by jehutting