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

This fixes #63.