Generating stable molecules using imitation and reinforcement learning