File and Socket Functions

These functions are used to open and close files and sockets with automatic cleanup registration and killing.