Moved Document class into separate file
Use block mode for Zip::File

Better way to ensure file is opened and closed correctly
Use Tempfile.open with block to ensure file is closed correctly