[UNIX] Simplify the file descriptor handling in SharedMemory