I'm a bit thinking out of the box here mainly because I have no idea how your programs work. To start of, there is literally no way to close a X-tab, where x is the tab you want. The only way is to actually be in that tab/page to close it. That's with PHP, HTML, JS etc. I assume you can achieve it with some C++/C# or whatever runs on your "client" rather than browser.
Now, the out of the box possible solution is to have some session management and an ajax call. My suggestion is to create a new session on a new tab. User gets a new tab, you give it number 1. Every x-seconds you do a ajax call to a script, which simply checks what "tab" it is. Let me give an example.
User opens a new tab, session is started and you have an array with the following:
$_SESSION['tabs'][1] = 'set';
Now this tab keeps doing calls to a file, to see if it should stay "alive". Basically you post with "Hi, I'm tab 1". When you check the session, tab 1 should be the only 1 there.
On a new tab, the session tabs gets an other value, named "2" which gets set. Now when tab 1 posts to the ajax caller, it should give a message back that it can be closed. When it receives that message it should invoke some JS like:
javascript:window.open('','_self').close();
This is just thinking out loud, I guess the basic idea should work, tho I have never tested it nor can I give you a full code example. Perhaps when I got some spare time I could try to create this.