Idiomatic defer usage.

Originally from Dustin Sallings.