Fixed O_APPEND behaviour
Implemented O_TRUNC