reset terminal modes before printing a message
run closehandlers on cleanup
Fix zlib for split newkeys