of just use a piece of javascript inthe cancel button itself, read some javascript manuals.
Note: you can only close windows, NOT the browser. If you try to close the browser, the user will always get a requester asking if he really wants to let you close the browser.