As far as your JS code being “called by other pages” - yes, by default your .js file is accessible to the internet. So not only can your own pages link to it via the script line, but I could link to it as well, if I wanted. From a security perspective, it should be treated the same way as your html files, that is, it is open for everyone to see.
But if I did include a script line where I included your JS code, what would happen? Well, to continue your example, if my web page happened to have a “Close” link, and was formatted like yours, then there’s a possibility the JS code would stop my videos just like it would stop yours. That usage is not going to affect your own users or web pages, only mine. So in theory you really shouldn’t care or know that I used it.
Yes, you can protect your js pages from me using them if you want.