Restore smart keyboard closing (#3975) that got clobbered