add try/finally blocks