Fix issues with data corruption in enc_file creation/opening