Fix database leaks

This fixes a couple of database leaks that were causing deadlocks in Pro.

Verification Steps:

- [ ] Start `msfconsole` with database support
- [ ] Try to get a psexec session with a bad password:

        use exploit/windows/smb/psexec
        set RHOST 192.168.1.105  # A windows host
        set SMBPass wrongpass
        set SMBUser administrator
        exploit -z

- [ ] VERIFY: Exploit failed
- [ ] Enter IRB shell: `irb`
- [ ] Run this nifty command to show ActiveRecord connections associated with framework threads:

        ActiveRecord::Base.connection_pool.instance_variable_get("@reserved_connections").map {|key, val| thread = Thread.list.find {|t| t.object_id == key}; "#{key}: #{thread ? "#{thread[:tm_name]} #{thread.inspect}" : "Unknown" }" }

- [ ] VERIFY: Only one connection exists.  If a second connection associated with the ModuleCacheRebuild thread exists, that's ok - you are a faster typer then me ;)

- [ ] Exit out of IRB.  `exit`
- [ ] Get a session.  For example, on Metasploitable2:

        use exploit/unix/ftp/vsftpd_234_backdoor
        set RHOST 192.168.1.101  # A Metasploitable host
        exploit -z

- [ ] VERIFY: You get a session
- [ ] Drop back into irb: `irb`
- [ ] Run the ActiveDirectory connection cmd:

        ActiveRecord::Base.connection_pool.instance_variable_get("@reserved_connections").map {|key, val| thread = Thread.list.find {|t| t.object_id == key}; "#{key}: #{thread ? "#{thread[:tm_name]} #{thread.inspect}" : "Unknown" }" }

- [ ] VERIFY: Only one thread exists.