If you open a custom inventory for a player and they close it themselves, it does not remove them from Inventory#getViewers. Everytime the inventory is reopened, a duplicate EntityHuman is added even if one is already in the list.
This can be solved by removing the viewer on InventoryCloseEvent, however, that is just a workaround. This does not seem like the intended behaviour of the method.
Below is the source code for a plugin i made to replicate the bug
Built the latest version of 1.18.2 just to test this and the bug is still there
Imgur: The magic of the Internet -> Console output