Hey, I love Hammerspoon and use it for all sorts of stuff! But in MacOS, you can bind a hotkey directly in the Keyboard preferences to the menu item, “Close Window”.
In Windows, you can just hit alt-F4, the standard hotkey to close an app. It closes the current vault, and not all open vaults.
(Not to say a built-in command wouldn’t be great.)