In short, you can't, things like close would be have to be done with a client-side scripting language like javascript. Thou you could have a link created by php that would like kinda like this.
<a onclick="parent.window.close()">close</a>
Now this will pop-up a dialog saying something like, "The webpage you are viewing is trying to close the window, is this ok" but thats just the IE scripting security stuff all the user has to say is ok and it closes.