Improve error handling when writing to the loopbreak fd