libcommon: fix a debug compile warning
libmemdisc: fix stage 0 and enhance error handling

In stage 0 we only want to see heap start and stack end.
Afterwards, stop all activity different from libc behavior. But
we've seen that there are output FIFO flushes and further debug
information. So skip these steps completely.
Close all FIFOs and the debug log in case an error occurs or stage
0 is configured.
Also close the input FIFO after running the constructor as it is
not required any more afterwards.