We should preserve the errno value so that the caller can report accurate error information, as the close() call could fail too. Change-Id: I1a36ace8f47ad3ea550aa3e2e272922633abfdca