Using close()

Files are closed by calling close(). The call to close() cancels any outstanding asynchronous I/O request that can be closed. close() waits for an operation that cannot be cancelled. For more information, see Using aiocancel. When close() returns, no asynchronous I/O is pending for the file descriptor. Only asynchronous I/O requests queued to the specified file descriptor are cancelled when a file is closed. Any I/O pending requests for other file descriptors are not cancelled. For more information, see the close(2) man page.