Release the FD lock before calling close() (#7646)