Having Multiple Points without Ruining the Script

Hello everyone,

I have a script that a point will detect the nearest window and get the lateral/vertical length.
However, I want to achieve this by having multiple points, instead of doing one point at a time.

When I place a second point (its a customized family which I deconstruct on Dynamo environment to get the center point) in revit, it crashes.

I attached the images / script Window Script.dyn (139.5 KB) below for your reference.
Any help would be greatly appreciated. thank you!