Example of Using closures to tidy up multiple locks