Sometimes I open my inventory to free my mouse and switch to other windows (I believe this bug works with the pause menu also), but when I switch back to Minecraft and press the inventory key again, it won't close. Neither does escape or any other method I try work. My only option is to restart the game, and on some multiplayer servers like survivalgames or shotbow, I end up losing all my progress that way. This works with all types of GUI that you leave open, including chat.
Wrong project