Cross-platform file locking in Python