function file_lock works. Implemented file_unlock and clear_file. Prolog predicates implemented too