Made more cross-platform by changing ->_fileno to fileno().