If a write is going to go past the end of the restricted area, write up to the end before throwing an exception.