Make it safe(r) in the presence of async exceptions

The first is to avoid losing a buffer full of events,  when
an async exception occurs between the buffer read and the writing
of the startRef and endRef.   Furthermore,  if it happens between
the writing of the startRef and endRef,  further use of the buffer
could result in memory faults.

The second is to avoid leaking an inotify file descriptor, when the
async exception occurs between the swapMVar and closeFd.