Is there a to prevent a file descriptor being closed