catch exception in main script now catches all exceptions and encrypts database then.