Raise error if can't write