Surround raise calls with try/finally to ensure the handle is closed.