Add LOCK_EX flag to file_puts_contents

Sometimes put and append throw exception with message 'failed to open stream: Invalid argument' because these functions do not consider exclusive control. So I propose to add LOCK_EX flag to file_puts_contents