Close streams in finally block.

Close input and output streams in a finally block so that they do not linger around and occupy system resources when an exception occurs.
Merge pull request #115 from fzs/fu-close-finally

Close streams in finally block.