Check return state of write(), otherwise this fails for compilers for unused result.