This is very unusual behavior you describe.
What version of FCP is this and what OS are you running on?
Are you using the default storage location for Libraries?
Have you designated the storage location of your libraries to a removable storage device or cloud service?
As a test, if you trash your FCP preferences* and then open the app so that it is in the default configuration with a new untitled library, can you successfully name, close and reopen a library?
*AI Overview:
To trash Final Cut Pro preferences, quit the app, then hold down Option+Command while relaunching it from the Dock.
A dialog will appear asking to delete the preferences; click to confirm, and Final Cut Pro will restart with default settings, resetting your custom window layouts and other personalized settings.
Step-by-Step Guide:
Quit: Final Cut Pro.
Press and hold: the Option and Command keys on your keyboard.
While holding the keys, launch Final Cut Pro from the Dock.
When the dialog box appears, click the Delete Preference button.
Final Cut Pro will then restart with its default settings.
What Happens When You Delete Preferences:
Resets Settings: Your custom window layouts, workspaces, and other personalized settings are reverted to their original default state.
No Data Loss: This action does not delete your libraries, media, projects, or any edited footage.
Diagnostic Folder: A folder named "Video App Diagnostic" may be created on your desktop, containing information and backups of the previous preference files.
After Deleting Preferences:
You will need to reopen your libraries from their saved locations.
You may need to reconfigure any custom preference settings you had set up.
MtD