See Backup your iTunes for Windows library with SyncToy. Keep a regular backup and check for errors after starting iTunes. If ratings are missing revert to an older copy of your iTunes Library database. In addition to backing up the whole library you can make manual copies of the .itl file in the Previous iTunes Libraries folder to increase your resilience against this issue.
Regarding preferences that reset when you restart iTunes that type of issue might have been fixed in the past by resetting the iTunesPrefs.xml file. iTunes 188.8.131.52 introduced a change with the way preferences are saved. It seems that what used to be stored in:
is now stored in a number of files spread amongst these folders:
(There could be others I haven't found.)
If preferences aren't being saved then try right-clicking the iTunes shortcut and using Run as administrator. Doing this once may resolve things. Otherwise try holding down Ctrl+Shift as you start iTunes to launch it in its own safe mode which again may sometimes help. If these three folders don't exist on your system creating them may allow iTunes to save its preferences properly. Alternatively deleting those that you do have may allow them to be recreated with the right permissions so that changes are stored in future.
Type %appdata%<return> in Explorer's address bar to reach the Roaming folder without having to display hidden folders.