This can be done by creating a new automation rule under Admin > Workflows > Automations >> Time triggers > New Rule:
Conditions:
Match ALL of the conditions
In tickets > if Status > is any of > 'Waiting on 3rd party'
In tickets > Hours since agent responded > is greater than > number of hours (example: 36)
Actions:
Set status as > Closed
Note:
- Please make sure that all mandatory fields for closing a ticket are filled before the status is changed to 'Waiting on 3rd party'.
- The 'Hours since' condition for 'custom status' is available from the Pro plan onwards.