You can create an Array list of the tabs open and then navigate to the tab you want to close and do it.
Here is what I tried and it worked like charm.
ArrayList<String> tabs2 = new ArrayList<String> (driver.getWindowHandles());
All you need to keep in mind is the sequence and you are good to go.
Hope this helped you.