Fix up some file monitoring stuff, start fixing buffer closing which just doesn't work properly