Terminate when out-of-memory

Adding a Terminate method to the Util class, and call that method in the situation of out-of-memory instead of throwing an exception.

@emanuelez @cmelchior @bmunkholm 
make it local to the case statement, and rename to terminateMethod