write: check return for good write