I tried all sorts of ways, but to no avail
One peculiarity is that it crashes even when ffx is inserted in a new project, and when the project file containing that ffx is opened, it crashes.
warning message does not appear
You haven't said what version of After Effects you're using (the exact version number, not just the year), whether this happened after updating, if it happens on other projects, or even what operating system you have, so there's not much to go on. The only things I can reccomend trying are first, seeing if there are any updates, and second create a new project and import your problematic .aep into the new one. This often fixes issues with projects that have corrupted header data, but it preserves your comps and animation.
2020 (17.0) and no updates
If I just put ffx it crashes
It crashes even when I put ffx in it, and it crashes even when I open a project with ffx in it.
Projects without ffx are open
Is there a reason you're still on 2020? There have been some major performance improvements in the last year. Even 17.0 isn't the latest version of 2020, there were several patches of 17.0, so the best thing to do is update. You can also trash your preferences, but 17.7 was the last released version of 17.x, but I recommend installing AE 22, which can be installed alongside AE 20 (as long as you make sure to uncheck the box to "Remove Previous Versions" when you upgrade).
Even with the 22nd version, the window closes.
Is this happening with one specific .ffx or all? Maybe the problem is with the preset itself.
Also, did you migrate your preferences from a previous version or start with new ones in 22?
all ffx and start with new ones 22
I wonder if there's a permissions issue, those can cause crashes because files can't be read properly. From the "Animation" menu you can apply a preset directly, as opposed to doing it from the Effects and Presets panel, so let's try this: Can you find the .ffx (or any one since they all seem to be causing a problem), move it to your Desktop, then apply it manually via the "Animation" menu?
I tried both the Animation menu and the Effects and Presets menu.
Where was the .ffx located when you tried the Animation menu?
D drive also I install ae on the D drive
It happened when I came back while working on another project file.
Unfortunately, I can't say then. It could very well be a permissions issue. Since you didn't have AE 22 installed previously, one good way to confirm if the D drive installation is the issue is to reinstall AE 22 on your C drive and try to apply one of the default presets.
Also, just in case you haven't, restart your computer. Perhaps you've already done this, but this simple step is often overlooked and can fix a lot of problems.