Prevent zombie state in case if child has exited with error

In order to prevent zombie state when child exits, parent has to collect it's exit status by calling waitpid