Key fob not working :(

So I unlocked my car opened the door took my belongings out and tried to lock it as normal but it doesn't seem to work! Changed batteries and also used spare key however no luck yet!

So then I started the engine, locked doors with key (manually), opened and closed all the doors, attempted to lock/unlock from the switch inside everything works but yet key fob doesn't!

After a good hour the key fob locked the doors all of a sudden and now it doesn't seem to unlock :( anybody could help please?