[FixRM #8312] Fix file handle leaks

When file.open() is used, module must make sure it's closed, otherwise as long as you have the console running, you are leaking.

See:
http://dev.metasploit.com/redmine/issues/8311