Hide Reply button when topic is closed and user is logged out

Hello,
URL: http://yourtechadvisors.com/forums/topic/testing-safe-to-ignore/
On this page, the team here helped me create a Reply button that opens the BBPress reply form. There is one problem. The Reply button shows up when users are logged out and when admins close topics. Is there anyway to hide this button to logged out users and when topics are closed?
The button code can be found in footer.php and functions.php.

If you cannot figure it out, Predrag Dubajic and Adam Czajczyk have had the most experience with this implementation.

Thanks, support access is open. :smiley: