Fix bugs, add serial numbers and compression

Serial numbers not used for sorting yet.
PDFs can now be closed.
Base64 no longer used for unencrypted.
GZIP used for compression prior to encryption.