Flush timing

Attempts to address #135 by making sure flushing can't occur after a file is closed.  Also added logging statement when syncing.