Clean up log locking. Use the FILE* from qemu_log_trylock more often. Support per-thread log files with -d tid.