Hey, I had the same problem (Nexus 5) and I think I know what is the cause for this problem. It is the same as @Bash-Horatio specified.
The device has two identifiers:
Google Android [0100]
LGE Nexus 5[0232]
Now, whenever the device is on fastboot it is identified as Google Android [0100] but when it moves to Recovery mode it is identified as LGE Nexus 5[0232]. Seems like the script is loosing the connection to Google Android [0100] right when the device is going to recovery mode.
So, under VirtualBox you should go to Machine -> settings -> Ports -> USB. Check to "ON" the "Enable USB Controller" and "USB 1.1 (OHCI) Controller". On the right, there are small blue usb icons to add/remove usb filters. You should add two filters for each device identifier (i.e. Google Android [0100] and LGE Nexus 5[0232]).
How? Connect the device when it is NOT in fasboot and add a usb filter (should be LGE Nexus 5[0232]). After having this filter switch your device to fastboot and then add a new filter (should be Google Android [0100]).
Once you have two usb filters you can run the ubports.
For non-VirtualBox I would say that you should disconnect / connect the device when ever your phone switched to Recovery Mode so the script will recognize the device with its new identifier (LGE Nexus 5[0232]).
for me it worked fine after few hours of frustration...
Hope it will help.
A'aron