Check whether return value of popen.close() is not None

This fixes #63.
Merge pull request #64 from avdv/issue-63

Check whether return value of popen.close() is not None