Instead of storing the status ID when closing or reopening a ticket, store its name, that way if the status is eventually deleted, there are no errors.
This is how ticket history is done, so it will be consistent.