From Kx Wiki
hclose (hclose function)
Closes a file or process handle.
q)h:hopen `::5001 q)h"til 5" 0 1 2 3 4 q)hclose h q)h"til 5" ': Bad file descriptor
Note: hclose does not flush pending messages on sockets. If you need to process pending msgs on a handle first, then send a sync chaser msg to the remote, e.g. h"".
Note: Attempting to hclose 0 will fail with 'domain since 0 needs to stay open for writing in order for plugins to communicate with q and for the q process to send commands to the local log file (if any). To disable reading from handle 0, redirect from /dev/null.
For a complete list of functions, see the kdb+ Function Reference.