fixed write_and_close to only work if we aren't using raw devices