Merge "Slightly refactor signal handling and fd closing" am: 1f332b2dde
am: 69c1204d6d

Change-Id: I1a2fc0d0256d781f16783cfa2f2235fb5d6e1c46