replaced proc.wait() by proc.terminate for better (?) crossplatform compatibility