Words ending in the suffix - ly are adverbs.
Words not ending in -ly may serve as an adjective or adverb, depending on the context of the sentence.
In the sentence you gave:
I enjoyed sitting close to the windows and looking at the view
I (subject noun) enjoyed (past tense verb) sitting (gerund [verb acting as a noun]) close (adjective, since it is describing a gerund) to the windows (prepositional phrase) and looking (gerund [verb acting as a noun]) at the view (prepositional phrase).
Close to the school, there was a beautiful park with many trees around it。
Close (adjective, since it is describing a prepositional phrase, which acts as a noun) to the school (prepositional phrase), there was a beautiful (adjective, since it described a noun) park (subject noun) with many trees (prepositional phrase) around it (prepositional phrase).