Update syncPerfGraphs to include line feeds in final log lines.

Also, use context manager to ensure logfile is closed (instead of manually
calling .close() and potentially accidentally leaking a file handler).