added some output and got file opening modes correct for overwriting decrypted