libslc: Refactor _close to function + Factor out error codes from errno.h