Tidy up IO functions

Show error code on error during compression.
Fix encryption/decryption of directories

* Swap source/output for IO checksum generation
* Set source as uninitialised if encrypting a directory