This is improvement for @hamstergene answer. Implementation location has been changed and all implementations calls the same API implemented differently for different systems.
Current code for closing descriptor is located here and looks like this:
impl Drop for FileDesc {
fn drop(&mut self) {
usercalls::close(self.fd)
}
}