A family of Microsoft word processing software products for creating web, email, and print documents.
As far as I'm aware, there is no way to remove the Share button.
Instead of trying to hit the "X" button, use the keyboard shortcut Alt+F4 to close Word.
Alternatively, you can add a Quick Access Toolbar button for the "Close or Exit" command. Unfortunately, that's one of the ones for which Microsoft hasn't provided a unique icon, so it appears as a circle.