This function terminates a process if a stream was used incorrectly. It will work similar to an assert, but it is not possible to compile without this. Purpose is to prevent problems with missing length/capacity checks