Simple changes

- Use os.remove instead of system callback.
- Use with statement with open.