restructure, remove daemon and add proper closing with pushing last open file to S3 and CloudWatch update