added a close statement for the fileOutputStream

i'm fairly certain that should make everything work properly