Can you be sure that process exited in next line? How can you improve code in here?