Switch to |fs.close| calling |fs.flush|

Issue #388.
- Adds a dirty flag to our FD, updates it on write/truncate/flush
- Only flush if the dirty flag is set
- |fs.close| calls flush