Merge "Slightly refactor signal handling and fd closing"