Use finalizer to kill the FdCache thread when it is no longer needed

Pinging @kazu-yamamoto. Seem reasonable?