ability to end subprocesses gracefuly

This allows to close subprocess gracefully, and also adds parameter, that waits for the process to actually end.