Closing fd even on error; Conditional main for libLoading
Fixed merge conflict