Yes, you can unpublish your Leanpub book or course any time. You can also re-publish it any time, if you change your mind.
To unpublish a book, please go here:
...making sure to replace YOUR_BOOK with your book's unique web address.
To unpbulish a course, please go here:
...making sure to replace YOUR_COURSE with your course's unique web address.
If you would like to put your book or course into "Stealth Mode", so it is not visible to the public, please see this article.