In theory it's possible, but it's extremely easy to get around it, making it not worth the trouble.
What if the user opens the file and then closes it without saving it? The "counter" will note update and the user will be able to continue opening the file without problems. Also, they can simply disable JS and this entire mechanism won't work at all.
If you want to do it in a way that's reliable you need to shell out large amounts for a DRM solution.