There are several possible causes of this problem. The washer may not be able to balance a load properly so that it can ramp up to a high speed spin in some situations. A problem with excessive suds in the washer can also prevent the cycle from being completed normally. A problem with the drain line could prevent the washer from draining and spinning properly.
Since the washer works in most cycles, you may not have a component failure in the washer. If you do have a component problem, it should be covered by the manufacturer warranty. Follow the instructions in your owner's manual for warranty service if necessary.
Before calling for warranty service, I recommend that you take these troubleshooting steps that may resolve your problem:
When a load does not finish, see if you can redistribute the laundry inside the spin basket and then run a drain/spin to finish the cycle.
Check the laundry for excessive suds or foam when the washer does not spin out the clothes properly. Excessive suds will prevent the washer from draining and spinning. If you see excessive suds, you will need to drastically cut back on the amount of detergent that you are using. You should only need about 1 tablespoon of detergent per wash load. You may need even less for a while if you were using too much. The fibers of your garments could have detergent still dissolved in them that will emerge during a wash cycle for a few loads. Make sure that you are using HE (High Efficiency) detergent in the washer. Failure to use HE detergent can result in excessive suds.
Check the installation of your drain hose. Make sure that the drain hose is not stuck way down the stand pipe. It should only protrude down the stand pipe about 6" to 8". Make sure that the washer drain is working properly. Check the drain hose for kinks or clogs.
If these tips don't help you resolve the problem that you are having, then you may need to have the washer examined by a service technician.
If you need more help, reply with additional details and the full model number of your washer. (The number that you provided is a part number for the owner's manual. I used that part number to see the type of washer that you have.)