Closing fd even on error; Conditional main for libLoading