Gracefully handle DOM destruction