When I open regedit and expand a folder and open regedit later the folder stays expanded. how can I disable this?
How can you disable it? Why, through the Registry, of course! You'll need to be in the admin account, or yours must have admin privileges.
In regedit, navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit and look for the value LastKey. Double-click it and clear the string. Then right-click the Regedit key (in the lefthand pane) and select Permissions. Set Permissions to Deny for any/all users/groups.