You can override the edit link completely so that whereever it is used, your code is used instead.
- Go to Setup > Customize > Opportunities > Buttons, Links and Actions
- Click "Edit" next to the Edit link
- select a VisualForce page
It won't be exactly the same experience for your users because the browser will navigate to your new page, popup the alert, and either navigate straight back to where they came from, or navigate forward to the Edit page.
To enable navigating forward to the edit page you need to tell SFDC to not use the override this time, by adding this parameter to the URL:
There are other ways to achieve a similar effect:
You could have a "Closed Opportunity" record type, with a page layout where all the fields are Read-Only. If you add a workflow to switch the opportunity to the "Closed.." type when it is closed (and switch it back if it is re-opened?) then users will not be able to edit the opportunity when it is closed. (Unless they have the Edit Read Only Fields permission - handy for admins).
You could add a validation rule that checks for the opportunity stage, and a long list of fields that you are checking for ISCHANGED.