Add more logging and close log handles on exit