Sounds like you became lucid and then woke up because of it. That's common when starting out, just keep at it and that will stop happening. And what you did where you thought about the dream you wanted is called dream incubation