Added cancelWriting method to the context