file extracted from IOCipher DB is getting corrupted

file extracted from IOCipher DB is getting corrupted because of memory leaked by out stream. Proper closing of the out stream will fix the issue