problem releated to Ruby activerecord

Hello friends

I have written a class in ruby which creates database table in mysql.
I have given an option of overwriting the database table if it already
exists. when i run the code it creates the table in the database for
the first time but when i try to overwrite the table by running the
code again it gives me an error

C:\ruby\Crystallizer1>ruby murrayTest.rb
created table audit_trail_entries
created Ruby class for AuditTrailEntry

c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1032:in `sync=': closed
stream (IOEr
ror)
        from c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1032:in
`write'
        from c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1092:in
`finalizer'
        from ./nxw-persistency-0.2/nxw-persistency-0.2.rb:22:in `call'
        from ./nxw-persistency-0.2/nxw-persistency-0.2.rb:22
        from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/
activesupport-1.4.1/li
b/active_support/dependencies.rb:488:in `load'
        from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/
activesupport-1.4.1/li
b/active_support/dependencies.rb:488:in `load'
        from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/
activesupport-1.4.1/li
b/active_support/dependencies.rb:342:in `new_constants_in'
        from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/
activesupport-1.4.1/li
b/active_support/dependencies.rb:488:in `load'
        from ./persistencyDSL.rb:75:in `domain_object_class'
        from murrayTest.rb:32

I will appriciate your help
Thank you