Added finally clause to exit cleanly. Also added kill script for using with crontab