To begin this short discussion one has to differ between Sn2 and addition to the carbonyl group, as the former is driven by orbital interactions while the latter is driven by coulomb interactions.
This can be explained with a closer look at the carbonyl function.
due to the highly polarized π-bond between carbon and oxygen, carbon is rendered quite positive. It results that any nucleophile bearing a negative charge will be attracted to attack it. In addition the reaction of a carbanion and a ketone or aldehyde is irreversible!
there is fundamentally no way in which the carbanion could ever be considered as a leaving group.
On the other hand Sn2 reactions appear on saturated carbon (in the best case methyl or primary) with at least one good leaving group (e.g. a halide or tosylate). Often the sigma bond connecting carbon and the leaving group is not even polarized, at least not significantly. Just consider the electronegativity of iodine, the BEST leaving group for SN2.
That is why orbital interactions are more dominant in thess kind of reactions. It can be easily noticed that a potential nucleophile has to donate its electrons into a sigma antibonding orbital in order to react with the carbon electrophile. These kind of orbital can be considered as very high in energy as it is the counterpart of the sigma bonding orbital which is quite stable.
Therefore the best nucleophiles for nucleophilic attack on saturated carbon is usually a second or third row nucleophile like sulphur or phosphorus (Wittig reaction).
Therefore for a carbanion the irreversible addition to the carbonyl group happens much faster, resulting in a alkoxid. The new formed alkoxid is in close proximity to the chlorine substituted carbon and therefore likely to form the five membered ring .
Any references that support everything written above can be found in Clayden, Organic chemistry second edition.
Specifically the chapter nucleophilic substitution at saturated carbon will help.
Best regards,
John