Assign fd after check for open.
Assign positional arguments properly.