How to get last active tab in Safari using AppleScript?
Answer: this is not possible since the list of active previous tabs isn’t stored in a way AppleScript can know how to go back and undo a window close operation.