I would do this under a `finally` block, so that it always runs, even if the code raises an exception.