Made log_open() non-static and moved log_close() next to it.