Implemented close_last

Passed 14/18 test cases. Didn't pass 12, 15, 16, 18. Also has bug where you can't test more than once.