Hey Janshi
Your problem sounds like an issue with your wifi-network. I hope you find a solution for it.
Concerning your script: I think you'd be better off creating a new custom workflow for it, since it does something completely different to the toggle-wifi script.
Thank you Mark. I've updated the workflow on Packal.
I've added a small attribution, but Packal doesn't seem to want to update the description (nor the fact that it runs absolutely fine on Yosemite).
Jason, I must thank you very much! I'd never have found this bug...
I'm pushing a fixed version to Packal right now. Find it here: http://www.packal.org/workflow/toggle-hidden-files
A workflow for toggling the visibility of hidden system files (e.g. files with names starting with a dot: .bash_profile) in Finder.
Get it at http://www.packal.org/workflow/toggle-hidden-files.
Report bugs (unlikely to impossible edit: entirely possible but hopefully fixed now) here.