Prevented Crash due to subprocess module

Using the subprocess module was causing the program to crash, replaced
it with an alternative from the os module.