             
             let alpha = 1 - distance * swipeToDissmissFadeOutAccelerationFactor
             
-            closeButton.alpha = alpha
+            closeButton?.alpha = alpha
             headerView?.alpha = alpha
             footerView?.alpha = alpha
         }

public class GalleryViewController : UIPageViewController, UIViewControllerTransitioningDelegate, ImageViewControllerDelegate  {
    
    //UI
    private var closeButton: UIButton!
    public var headerView: UIView?
    public var footerView: UIView?
    

    
    private func configureCloseButton() {
        
        closeButton?.addTarget(self, action: "close", forControlEvents: .TouchUpInside)
    }
    
    func createViewHierarchy() {
        
        if let close = closeButton {

            self.view.addSubview(close)
        }
    }
    
    func configureHeaderView() {
