Solved the corrupted post.json issue

Added locking to the file where post data are saved