Mimics the Go Lang defer in C