Handle "out of memory" situations.
Bugfix: --wait mode was always ON, regardless of arguments.