My camera started the same scenario. Lens retracts a few seconds after cover is opened. Thanks to this forum, I discovered it is something in the sliding lens cover.
If I put pressure on it, the camera will stay on. It has been on over half an hour now since I read this forum.