Sometimes when I quit FCPX I get a message saying background tasks are cancelling. What background tasks ?? The background task window is not showing any running. I have background rendering switched off. So what else could be running and, most important, how do I prevent them from running in the first place. FCPX is very sluggish so maybe these invisible BG-tasks are causing that. I am running FCPX 10.4 on Sierra on an iMac late 2012 32GB RAM
Yes, there are undefined, or invisible tasks every application does all the time. NLEs more than anything else, besides scientific research apps. You don't want to stop these, and they shouldn't interfere with anything, it's just the app doing its normal work. Creating links, writing database files, modifying database files, etc. There's a database engine running under FCPX, too, which you defining don't want to stop prematurely. It's not really anything to worry about in my experience. When you quit an app, it also has to record a bunch of stuff about the current state of projects, assets, etc, and sometimes this can take a few seconds longer than at other times, and is nothing that effects your performance.
As for sluggishness, what codec/resolution video are you editing, with what GPU would have a MUCH larger impact on performance than the apps normal tasks.