Move the codes out of the finally block
Merge pull request #1926 from zsxwing/fix-merge-finally

Move the codes out of the finally block